Quots in Linux - Tecnew

Home Ads

Quots in Linux

Quots in Linux

Share This



 Single and double Quots in Linux 

In Double Quots ""   $ value is takes the value of the variable 
1.     speaker=”marshal” assigned to speaker
echo $speaker it shows the output marshal
echo “I have got $speaker speaker recently.”  $ is reads the variable value
I have got marshal speaker recently.


1.     speaker=’marshal’ assigned to speake
echo ‘I have got $speaker speaker recently.’  $ is reads the variable value
I have got $speaker speaker recently. In single quot $ is read as a text 


In some places you use $ as it is in double quots in such a case you use \$5  echo "world spending $5 billion for $virus" 




1.     Output of the command is stored in to the variable

        Back tick is the command is down to the esc button `` you kept in between the backtick              out=`uptime`
           This is two types we use
        1.Out=`uptime`
           Echo $out    it gives the uptime command output
        2.Out=$(uptime)
           Echo $out    it gives the uptime command output
          free -m | grep Mem | awk '{print $4}' This command gives the out put of 4th column
        FREE_RAM=` free -m | grep Mem | awk '{print $4}'`  it stores the output of the the                    command in to that variable FREE_RAM to prin the output type echo $FREE_RAM to               give the output


1.     Two know available df -h disc space of free size only by using the command by         df -h | awk ‘{print $4}’ it shows the fourth column of free disc space



To show uptime in that we print only time by the following command                         UPTIME=$(uptime | awk '{print $1,$2,$3}')                                                                                           echo $UPTIME                                                                                                                                    12:46:58 up 7:05,




No comments:

Post a Comment