• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

bash script

Deceiver

Senior member
How do I input variables from the command line into a bash script? Right now I have a variable declared in the script that I have to change each time I run it and it would be nice to specify this variable through the command line as I run it.
 
Really simple....

Use the $<number> notation.

[12:02pm] kelly (~) # sh test.sh hello again

The first argument is hello , the second argument is again

[12:02pm] kelly (~) # cat test.sh
#!/bin/sh

echo ""
echo "The first argument is $1 , the second argument is $2"
echo ""
exit 0
 
Back
Top