In the molecules directory, imagine you have a shell script called script.sh containing the following commands:
head -n $2 $1
tail -n $3 $1
While you are in the molecules directory, you type the following command:
$ bash script.sh '*.pdb' 1 1
Which of the following outputs would you expect to see?
.pdb
in the molecules
directory.pdb
in the molecules
directorymolecules
directory*.pdb
$ head -n 1 cubane.pdb ethane.pdb octane.pdb pentane.pdb propane.pdb
$ tail -n 1 cubane.pdb ethane.pdb octane.pdb pentane.pdb propane.pdb
The shell does not expand '*.pdb'
because it is enclosed by quote marks. As such, the first argument to the script is '*.pdb'
which gets expanded within the script by head
and tail
.