I think because the shell probably attaches itself to /dev/tty but I may be wrong. Why wouldn't you just set execute permissions on the script and use.
I think because the shell probably attaches itself to /dev/tty but I may be wrong. Why wouldn't you just set execute permissions on the script and use: a=`. /somefile` If you want to capture stderr and stdout to a, just use: a=`.
/somefile 2>&1` To check file is executable first: if -x . /somefile ; then a=$(./somefile 2>&1) else a="Couldn't find the darned thing. " fi and you'll notice I'm switching to the $() method instead of backticks.
I prefer $() since you can nest them (e.g. , "a=$(expr 1 + $(expr 2 + 3))").
Its not about the permissions... I want the either error messages or return values to be stored in the variable. – Roman M Feb 6 '09 at 7:37 What I'm saying is that you don't need to run sh to run the script (and sh will impose its own firewall on the output if you do). Just run the script directly and, for that, you need to 'chmod +x' it.
– paxdiablo Feb 6 '09 at 7:41 Try the following: "chmod u+x somefile; a=. /somefile" and see what a gets set to then. – paxdiablo Feb 6 '09 at 7:44 but for my case somefile my not exsists, how to avoid seeing the message "no such file or dir" in the shell but rather have it stored in the variable – Roman M Feb 6 '09 at 8:11 "if -x .
/somefile " is what you're looking for. – paxdiablo Feb 6 '09 at 8:21.
You can try the new and improved way of doing command substitution, use $() instead of backticks. A=$(sh . /somefile) If it still doesn't work, check if somefile is not actually stderr'ing.
I tried and it didn't work ... – Roman M Feb 6 '09 at 7:36 probably it can't actually find somefile ;) – Bogdan Feb 6 '09 at 17:53.
You are correct, the stdout of . /somefile is stored in the variable a. However, I assume somefile outputs to stderr.
You can redirect that with 2>&1 directly after . /somefile.
– Roman M Feb 6 '09 at 7:35 No the stdout of sh is stored in a, sh is not passing the stdout of . /somefile back to it's caller. – paxdiablo Feb 6 '09 at 7:42.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.