www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - OT: Linux shell validate-all-command-before-executing-anything behavior?

reply "Nick Sabalausky" <a a.a> writes:
I'm trying to make a trivial shell script (as portable as possible) to build 
an executable and then run it. Basically something like this:

-----------------------------
#!/bin/sh
# Assume that foo is a natively-compiled program,
# not a script or anything, and gets placed in './bin'
make foo
./bin/foo
-----------------------------

But, when I try to run that, it complains that './bin/foo' doesn't exist and 
exits *before* it ever actually invokes 'make foo' (just an example) which 
is exactly what *creates* './bin/foo' in the first place. Can anyone provide 
any insight/perspective/background-info to this apparent "validate all 
commands in the script against the filesystem before actually running the 
script" behavior?

I apologize for bringing something so enormously off-topic here, but the 
closest thing I'm getting to an intelligent answer over at the Ubuntu Forums 
is "It's 'make', not 'make foo', and if that doesn't work, what are you 
trying to build?" I'm a bit fearful for my sanity at the thought of bringing 
the same question to yet other forum that I don't already know for certain 
to be populated with people who actually know what they're talking about. So 
I just came straight here with it instead. I *know* that people here are 
intelligent.
Feb 14 2010
parent reply BCS <none anon.com> writes:
Hello Nick,

 I'm trying to make a trivial shell script (as portable as possible) to
 build an executable and then run it. Basically something like this:
 
 -----------------------------
 #!/bin/sh
 # Assume that foo is a natively-compiled program,
 # not a script or anything, and gets placed in './bin'
 make foo
 ./bin/foo
 -----------------------------
 But, when I try to run that, it complains that './bin/foo' doesn't
 exist and exits *before* it ever actually invokes 'make foo' (just an
 example) which is exactly what *creates* './bin/foo' in the first
 place. Can anyone provide any insight/perspective/background-info to
 this apparent "validate all commands in the script against the
 filesystem before actually running the script" behavior?
 
 I apologize for bringing something so enormously off-topic here, but
 the closest thing I'm getting to an intelligent answer over at the
 Ubuntu Forums is "It's 'make', not 'make foo', and if that doesn't
 work, what are you trying to build?" I'm a bit fearful for my sanity
 at the thought of bringing the same question to yet other forum that I
 don't already know for certain to be populated with people who
 actually know what they're talking about. So I just came straight here
 with it instead. I *know* that people here are intelligent.
 

I'd check to make sure that running "make foo" works because I don't think that bash does the checking you seem to be seeing. Also ask the question here: http://serverfault.com/ or here http://superuser.com Both sites tend to give good and fast results. -- <IXOYE><
Feb 14 2010
parent reply "Nick Sabalausky" <a a.a> writes:
"BCS" <none anon.com> wrote in message 
news:a6268ff1040c8cc7bdfbfa0e174 news.digitalmars.com...
 Hello Nick,

 I'm trying to make a trivial shell script (as portable as possible) to
 build an executable and then run it. Basically something like this:

 -----------------------------
 #!/bin/sh
 # Assume that foo is a natively-compiled program,
 # not a script or anything, and gets placed in './bin'
 make foo
 ./bin/foo
 -----------------------------
 But, when I try to run that, it complains that './bin/foo' doesn't
 exist and exits *before* it ever actually invokes 'make foo' (just an
 example) which is exactly what *creates* './bin/foo' in the first
 place. Can anyone provide any insight/perspective/background-info to
 this apparent "validate all commands in the script against the
 filesystem before actually running the script" behavior?

 I apologize for bringing something so enormously off-topic here, but
 the closest thing I'm getting to an intelligent answer over at the
 Ubuntu Forums is "It's 'make', not 'make foo', and if that doesn't
 work, what are you trying to build?" I'm a bit fearful for my sanity
 at the thought of bringing the same question to yet other forum that I
 don't already know for certain to be populated with people who
 actually know what they're talking about. So I just came straight here
 with it instead. I *know* that people here are intelligent.

I'd check to make sure that running "make foo" works because I don't think that bash does the checking you seem to be seeing. Also ask the question here: http://serverfault.com/ or here http://superuser.com Both sites tend to give good and fast results.

Thanks. I'm going to write up a quick sanity-check test, and if that doesn't help I'll try those places.
Feb 14 2010
parent reply "Nick Sabalausky" <a a.a> writes:
"Nick Sabalausky" <a a.a> wrote in message 
news:hlas20$1v1c$1 digitalmars.com...
 I'd check to make sure that running "make foo" works because I don't 
 think that bash does the checking you seem to be seeing.

 Also ask the question here: http://serverfault.com/ or here 
 http://superuser.com

 Both sites tend to give good and fast results.

Thanks. I'm going to write up a quick sanity-check test, and if that doesn't help I'll try those places.

Damnnit, that'll teach me not to shell-script when I haven't eaten anything. The problem was south of the keyboard.
Feb 14 2010
parent reply "Nick Sabalausky" <a a.a> writes:
"Nick Sabalausky" <a a.a> wrote in message 
news:hlasur$20mc$1 digitalmars.com...
 "Nick Sabalausky" <a a.a> wrote in message 
 news:hlas20$1v1c$1 digitalmars.com...
 I'd check to make sure that running "make foo" works because I don't 
 think that bash does the checking you seem to be seeing.

 Also ask the question here: http://serverfault.com/ or here 
 http://superuser.com

 Both sites tend to give good and fast results.

Thanks. I'm going to write up a quick sanity-check test, and if that doesn't help I'll try those places.

Damnnit, that'll teach me not to shell-script when I haven't eaten anything. The problem was south of the keyboard.

And you'd think I'd learn to spell my curse words correctly!
Feb 14 2010
parent BCS <none anon.com> writes:
Hello Nick,

 "Nick Sabalausky" <a a.a> wrote in message
 news:hlasur$20mc$1 digitalmars.com...
 
 Damnnit, that'll teach me not to shell-script when I haven't eaten
 anything. The problem was south of the keyboard.
 


Oh, I'm not shure I don't prefer that version. Right up there with "Dag nab it!" :) -- <IXOYE><
Feb 15 2010