Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Question
In linux, in bash scripting, how do you print out the first command line argument given when script is run (e.g. if you run "./test.sh hello", "hello" would be printed)
Answer
echo $1
^^^ the $1, prints our the first command line argument, $2 the second, $3 the third, etc

Question
In linux, in bash scripting, how do you print out the first command line argument given when script is run (e.g. if you run "./test.sh hello", "hello" would be printed)
Answer
?

Question
In linux, in bash scripting, how do you print out the first command line argument given when script is run (e.g. if you run "./test.sh hello", "hello" would be printed)
Answer
echo $1
^^^ the $1, prints our the first command line argument, $2 the second, $3 the third, etc
If you want to change selection, open document below and click on "Move attachment"

7. Shell Scripting
Now create a file important_data with anything in it and then run ./backup-lots.sh important_data , which will copy the file 10 times with 10 different extensions. As you can see, the variable <span>$1 has a special meaning--it is the first argument on the command-line. Now let's get a little bit more sophisticated ( -e test whether the file exists): 5 10 #!/bin/sh if test "$1" = "" ;

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.