Topic 10

Date: 3/22/2017
Linux shell scripting tutorial
Linux System Administration


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