Given the following script that is run through. When will “I am here” be printed?

Given the following script that is run through. When will “I am here” be printed?Category: Linux EssentialsGiven the following script that is run through. When will “I am here” be printed?
Linux Questions Staff asked 1 year ago

Given the following script that is run through ./test.sh hello goodbye:

if [ -f $2 ]; then
    echo “I am here”
fi

When will “I am here” be printed?

  • If there are two files in the current directory
  • The script will always print “I am here”
  • Never
  • If a file called “hello” exists in the current directory
  • If a file called “goodbye” exists in the current directory

About the author