Hi. I'm a newbie in scripting and i have this problem: i want to use the 'fuser' command on a file to tell if it's being accessed (for my purposes: still being written). I want to save the output of the command and later compare with the 'not being used' result.
-bash-3.00$ script.sh
TATA before: ii
LockedFiles/deals.csv:
TATA after:
So the output of the command is not going to the variable but to the screen (altough the variable value is erased) and I can't figure out why! Can you help me?
I think that's just it! To explain in detail: when i execute
TATA=`fuser LockedFiles/deals.csv`
in the script, the part of the output of the command that would go to the Standard Output really goes into the variable, and the part of the output that would go to Standard Error is written in the screen. The first part of the output was actually empty ("") in the case i was running, and that's why the value in the variable was erased.