Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

What does this shell script do?

What does this shell script do?


Answer:

FOO=/tmp/foo
if [ ! d $FOO ]; then
mkdir $FOO
fi
Creates /tmp/foo if it does not exist

A file begins with #!/bin/csh. This means:

A file begins with #!/bin/csh. This means:



Answer: Running the script will invoke /bin/csh to interpret the rest of the file

The echo command:

The echo command:



Answer: Is used to output text to the console

The grep command...

The grep command...


Answer: ...will display all the lines in a file containing the specified Regular Expression.

Which two commands do the same thing?

Which two commands do the same thing?


Answer:
- tar c foo | gzip > foo.tar.gz
- tar czf foo.tar.gz foo