Script: how to assign values to variables using "awk" results?
I want to write a script to find out the journal size of an ext3 file system. I have two commands (graciously provided by unSpawn):
Code:
The journal is located at inode: Code:
#!/bin/bash http://www.tldp.org/LDP/Bash-Beginne...e.html#chap_03 left me stumped... |
Use backquotes(`) not single quotes(') to run a cmd and save the result thus:
var=`cmd` echo $var |
Aha. I'll try that this evening and be back with the result.
Anybody about why printing the results from within the script doesn't work? Can it be done less clumsily? |
Yep, works. After some thought, I even remembered why :rolleyes:, thanks chrism01.
I solved the other question by the same method, i.e. put the statement in back ticks and assigned the value to a variable (yes, I know I could put them out with "echo" but later on I want to calculate the byte value into MBs, so...). |
All times are GMT -5. The time now is 10:21 AM. |