Lesson 9

Date: 3/26/2014
Linux shell scripting tutorial
Linux for Engineering and IT Applications


Using quotes

  • Single forward quotes ' protect the enclosed text from the shell.
    echo 'error $?'
    echo 'shell name $0'
    

  • Double quotes allow all shell interpretations to take place inside them.
    echo "error $?" #gives the error code of the last command 
    echo "shell name $0" #gives the current shell name
    

  • Command substitution
    X=`expr 100 + 50 '*' 3`
    echo $X
    

    FSIZE=`wc -l /etc/profile`
    
    same as
    FSIZE=$(wc -l /etc/profile)
    



  • Take me to the Course Website