Hi everybody,
I'm stuck on a simple issue but I can't fix it...
On purpose to monitor filesystems space, I use the following command to get all filesystems :
Code:
myvar=$(df -Pk | egrep "[myFS]")
For example, with /run, I get the following :
Code:
tmpfs 202860 8836 194024 5% /run
tmpfs 5120 0 5120 0% /run/lock
cgmfs 100 0 100 0% /run/cgmanager/fs
tmpfs 202860 44 202816 1% /run/user/1000
I would like to get size and name values of each line, so I need to loop through the "myvar" variable, but it's not working...
I tried to do some stuff like :
Code:
while IFS='' read -r line; do
...
done <<< "$myvar"
It works with bin/bash but not with bin/sh... and I have to use bin/sh because target servers don't have bash installed.
Somebody has a solution ?
Thanks a lot.
Edit : Except if it's really needed, I don't want to use temporary files either.