Hi,,

 variable=`some_command`

===========================
Example::

#!/bin/bash

vv=`pwd`

echo $vv $vv $vv

When this file runs, it report the current directory to std out. (three times, on the same line)

Derek.


On 14/10/15 13:41, Bryce Stenberg wrote:
Hello again,

This is sort of following on from my previous post.

I have this command below to give me the temperature of hard drive 3 which 
works from command line:

smartctl -A /dev/sdc | grep Temperature_Celsius | awk '{print $10}'


but I'm having trouble getting it to run in a bash script file assigned to a 
variable.

In a script I've tried escaping the pipe symbols and the quotes but nothing 
seems to quite work...

DISKTEMP=smartctl -A /dev/sdc \| grep Temperature_Celsius \| awk \'{print $10}\'

DISKTEMP=$(smartctl -A /dev/sdc \| grep Temperature_Celsius \| awk \'{print 
$10}\')


It seems a simple enough task, can someone please show me how it should be 
written?

Thanks,
   Bryce Stenberg.
_______________________________________________
Linux-users mailing list
[email protected]
http://lists.canterbury.ac.nz/mailman/listinfo/linux-users

--
Sent from my Ubuntu computer

_______________________________________________
Linux-users mailing list
[email protected]
http://lists.canterbury.ac.nz/mailman/listinfo/linux-users

Reply via email to