Using commands in scripts
Hi all, I am just wondering how to use commands inside of a script.
In the code below, names is a variable. Quote:
Thanks. |
Quote:
Tickes are missing.. use with Quote:
|
Quote:
Code:
names=`cat newusers.txt | cut -f1 -d":"` |
IOW, generically
x=a b c means assign 'a b c' to x x=`a b c` means run the cmd a x=$(a b c ) is the same. Have a look at these http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/ |
"Tickes" (actually back-tics) are deprecated. The preffered usage is $(<command-string>)
Speaking to the thread title: Commands in scripts are the same as those typed in a terminal..the only difference is that--in a terminal--a long sequence of commands needs to be separated by ";"s (or use a "here document".) You can enter commands one at a time and verify how they work---then combine them in a script. |
Quote:
|
Unless you require compatibility with the original bourne shell, since $() is a bashism.
|
All times are GMT -5. The time now is 08:12 PM. |