draenor
March 13th, 2006, 09:28 AM
Hi, I'm having some problem redirecting output. I was about to make a simple bash script of "safe remove" for some standard types.
The idea is to do a tmp=`rm -i --preserve-root -v PATTERN`
Then I can compare the tmp output with standard strings and create my own error printings instead the one rm by default prints. However, rm hi.txt where hi .txt is a non-existant file causes error output. Now I want to catch that output and put it in my tmp variable, and NOT print it to stdout.
My idea then was tmp=`rm -i --preserve-root -v PATTEN 2>&1` 2> /dev/null.
This causes tmp to contain the error msg printed by rm without printing it to stdout. However, now I can't remove files who actually exist by some strange reason.
If you know a way to walk around this I'd be glad to know.
Secondly, I know this isn't the right forum but since I was making a post already .. Somehow some of my default laptop shortcuts doesn't work anymore, such as Fn+F11 for decreasing volume etc. I can't remember any action that may have caused this. Any idea of get them back ? (and yeah, in system->settings->keyboardshortcuts they are still assigned).
Thanks in advance for the help.
The idea is to do a tmp=`rm -i --preserve-root -v PATTERN`
Then I can compare the tmp output with standard strings and create my own error printings instead the one rm by default prints. However, rm hi.txt where hi .txt is a non-existant file causes error output. Now I want to catch that output and put it in my tmp variable, and NOT print it to stdout.
My idea then was tmp=`rm -i --preserve-root -v PATTEN 2>&1` 2> /dev/null.
This causes tmp to contain the error msg printed by rm without printing it to stdout. However, now I can't remove files who actually exist by some strange reason.
If you know a way to walk around this I'd be glad to know.
Secondly, I know this isn't the right forum but since I was making a post already .. Somehow some of my default laptop shortcuts doesn't work anymore, such as Fn+F11 for decreasing volume etc. I can't remember any action that may have caused this. Any idea of get them back ? (and yeah, in system->settings->keyboardshortcuts they are still assigned).
Thanks in advance for the help.