simple sh scripting. How to put a result of a command to a variable?

Constantine cnst at rbcmail.ru
Mon Aug 11 14:49:25 PDT 2003


Hello!

I am writing a script, which involves unzipping some files. I would have 
to unzip 4 different zip-files from some directory, and I would need to 
unzip them to the directory, which would have the same name in it as the 
original zip-file, i.e. I would like to run something like "ls *.zip", 
have each file name recorded in some variable, and do a loop like "unzip 
$filename[$i] -d $filename[$i].unzipped/". Can someone help me with the 
code? How can I put the results of a command to a variable?

Cheers,
Constantine.



More information about the freebsd-questions mailing list