From komarek at cmu.edu Fri Jun 20 16:17:47 2003 From: komarek at cmu.edu (Paul Komarek) Date: 20 Jun 2003 16:17:47 -0400 Subject: [auton-users] scripts for platform exe names Message-ID: <1056140266.6699.15.camel@laptop> Hi everyone, At the recent AUTON lab meeting, some people asked for a way to programmatically discover the executable name for the current platform. I have written two scripts to help with this. *) archexe.sh: archexe.sh will print the name of the executable, and its return value indicates whether it is executable (0) or not (1) -- not that these return values correspond to standard shell practice. I spent a while writing the command-line help, so please run "archexe.sh -h" for more details. The project is specified with -p, and otherwise defaults to the current directory. *) runproject.sh: runproject.sh will run the executable for the given project (it uses archexe.sh to get the exectuable name). You can pass arguments for the project exectuable, and those arguments can include spaces. You can see what it would do using --fake. The return value is the same as the return value of the project executable. These scripts are in h/smallbutuseful. As written, these scripts require /bin/bash and the latest Make.common. Please update both smallbutuseful and gmake-magic. -Paul Komarek From komarek at cmu.edu Sat Jun 21 00:30:12 2003 From: komarek at cmu.edu (Paul Komarek) Date: 21 Jun 2003 00:30:12 -0400 Subject: [auton-users] scripts for platform exe names Message-ID: <1056169811.3148.4.camel@laptop> Hi everyone, At the recent AUTON lab meeting, some people asked for a way to programmatically discover the executable name for the current platform. I have written two scripts to help with this. *) archexe.sh: archexe.sh will print the name of the executable, and its return value indicates whether it is executable (0) or not (1) -- not that these return values correspond to standard shell practice. I spent a while writing the command-line help, so please run "archexe.sh -h" for more details. The project is specified with -p, and otherwise defaults to the current directory. *) runproject.sh: runproject.sh will run the executable for the given project (it uses archexe.sh to get the exectuable name). You can pass arguments for the project exectuable, and those arguments can include spaces. You can see what it would do using --fake. The return value is the same as the return value of the project executable. These scripts are in h/smallbutuseful. As written, these scripts require /bin/bash and the latest Make.common. Please update both smallbutuseful and gmake-magic. -Paul Komarek From dpelleg+ at cs.cmu.edu Mon Jun 23 14:57:06 2003 From: dpelleg+ at cs.cmu.edu (Dan Pelleg) Date: Mon, 23 Jun 2003 14:57:06 -0400 Subject: [auton-users] arch*.sh scripts Message-ID: <16119.19842.261134.940318@gargle.gargle.HOWL> Both of the new scripts fail on FreeBSD because /bin/bash is not installed there. There are many other systems in which this is true as well. As far as I know /bin/sh is pretty much guaranteed to exist on any UNIX-like system. From komarek at cmu.edu Mon Jun 23 15:09:56 2003 From: komarek at cmu.edu (Paul Komarek) Date: 23 Jun 2003 15:09:56 -0400 Subject: [auton-users] arch*.sh scripts In-Reply-To: <16119.19842.261134.940318@gargle.gargle.HOWL> References: <16119.19842.261134.940318@gargle.gargle.HOWL> Message-ID: <1056395395.27584.1.camel@laptop> On Mon, 2003-06-23 at 14:57, Dan Pelleg wrote: > Both of the new scripts fail on FreeBSD because /bin/bash is not installed > there. There are many other systems in which this is true as well. > > As far as I know /bin/sh is pretty much guaranteed to exist on any > UNIX-like system. I agree that there are many borken systems out there. ;-) Would you mind checking for sh compatibility? On GNU/Linux systems, sh is a symlink to bash, and bash doesn't completely disable all bash-isms in sh-mode. Perhaps the easiest thing to do is symlink /bin/bash -> /bin/sh and try running them. -Paul From komarek at cmu.edu Mon Jun 23 15:11:24 2003 From: komarek at cmu.edu (Paul Komarek) Date: 23 Jun 2003 15:11:24 -0400 Subject: [auton-users] arch*.sh scripts In-Reply-To: <1056395395.27584.1.camel@laptop> References: <16119.19842.261134.940318@gargle.gargle.HOWL> <1056395395.27584.1.camel@laptop> Message-ID: <1056395483.27584.4.camel@laptop> On Mon, 2003-06-23 at 15:09, Paul Komarek wrote: > On Mon, 2003-06-23 at 14:57, Dan Pelleg wrote: > > Both of the new scripts fail on FreeBSD because /bin/bash is not installed > > there. There are many other systems in which this is true as well. > > > > As far as I know /bin/sh is pretty much guaranteed to exist on any > > UNIX-like system. > > I agree that there are many borken systems out there. ;-) > > Would you mind checking for sh compatibility? On GNU/Linux systems, sh > is a symlink to bash, and bash doesn't completely disable all bash-isms > in sh-mode. Perhaps the easiest thing to do is symlink /bin/bash -> > /bin/sh and try running them. > Scratch that request. I just remembered I used $(foo) instead of `foo`, so I think sh is guaranteed to fail. I'll try to get around to it. -Paul From dpelleg+ at cs.cmu.edu Mon Jun 23 15:29:43 2003 From: dpelleg+ at cs.cmu.edu (Dan Pelleg) Date: Mon, 23 Jun 2003 15:29:43 -0400 Subject: [auton-users] arch*.sh scripts In-Reply-To: <1056395395.27584.1.camel@laptop> References: <16119.19842.261134.940318@gargle.gargle.HOWL> <1056395395.27584.1.camel@laptop> Message-ID: <16119.21799.244201.21230@gargle.gargle.HOWL> Paul Komarek writes: > On Mon, 2003-06-23 at 14:57, Dan Pelleg wrote: > > Both of the new scripts fail on FreeBSD because /bin/bash is not installed > > there. There are many other systems in which this is true as well. > > > > As far as I know /bin/sh is pretty much guaranteed to exist on any > > UNIX-like system. > > I agree that there are many borken systems out there. ;-) > > Would you mind checking for sh compatibility? On GNU/Linux systems, sh > is a symlink to bash, and bash doesn't completely disable all bash-isms > in sh-mode. Perhaps the easiest thing to do is symlink /bin/bash -> > /bin/sh and try running them. > > -Paul Paul already found one non-standard call ( $() instead of `` - I'd have missed this since the FreeBSD sh also happens to support this). Apart from that, "make" needs to be "gmake" everywhere. With this change I can make "sh ../smallbutuseful/archdir.sh" work. archexe.sh doesn't like the pushd/popd. Maybe just enclose a big chunk in a () block (meaning to spawn a subshell for it, which forget all the "cd"s you do after it terminates). From pgunn at cs.cmu.edu Mon Jun 23 15:37:30 2003 From: pgunn at cs.cmu.edu (Pat Gunn) Date: Mon, 23 Jun 2003 15:37:30 -0400 (EDT) Subject: [auton-users] arch*.sh scripts In-Reply-To: <16119.21799.244201.21230@gargle.gargle.HOWL> Message-ID: > Paul already found one non-standard call ( $() instead of `` - I'd have > missed this since the FreeBSD sh also happens to support this). Apart from > that, "make" needs to be "gmake" everywhere. > > With this change I can make "sh ../smallbutuseful/archdir.sh" work. > > archexe.sh doesn't like the pushd/popd. Maybe just enclose a big chunk in a > () block (meaning to spawn a subshell for it, which forget all the "cd"s > you do after it terminates). I personally think this is wasted effort -- it makes the script harder to read, and for very little benefit. Bash is on all facilitized OS's we need to care about, and is on many other OS's, and is easy to install elsewhere. I don't think it's at all unreasonable to require it, any more than requiring that gnumake be installed is unreasonable. -- Pat Gunn Research Programmer, Auton Group, CMU From komarek at cmu.edu Mon Jun 23 15:48:36 2003 From: komarek at cmu.edu (Paul Komarek) Date: 23 Jun 2003 15:48:36 -0400 Subject: [auton-users] arch*.sh scripts In-Reply-To: <16119.21799.244201.21230@gargle.gargle.HOWL> References: <16119.19842.261134.940318@gargle.gargle.HOWL> <1056395395.27584.1.camel@laptop> <16119.21799.244201.21230@gargle.gargle.HOWL> Message-ID: <1056397716.27584.7.camel@laptop> On Mon, 2003-06-23 at 15:29, Dan Pelleg wrote: > Paul Komarek writes: > > On Mon, 2003-06-23 at 14:57, Dan Pelleg wrote: > > > Both of the new scripts fail on FreeBSD because /bin/bash is not installed > > > there. There are many other systems in which this is true as well. > > > > > > As far as I know /bin/sh is pretty much guaranteed to exist on any > > > UNIX-like system. > > > > I agree that there are many borken systems out there. ;-) > > > > Would you mind checking for sh compatibility? On GNU/Linux systems, sh > > is a symlink to bash, and bash doesn't completely disable all bash-isms > > in sh-mode. Perhaps the easiest thing to do is symlink /bin/bash -> > > /bin/sh and try running them. > > > > -Paul > > Paul already found one non-standard call ( $() instead of `` - I'd have > missed this since the FreeBSD sh also happens to support this). Apart from > that, "make" needs to be "gmake" everywhere. > I chose to use make because I've seen some GNU systems installing gmake as "make" with no symlink to gmake. > With this change I can make "sh ../smallbutuseful/archdir.sh" work. > Terrific! > archexe.sh doesn't like the pushd/popd. Maybe just enclose a big chunk in a > () block (meaning to spawn a subshell for it, which forget all the "cd"s > you do after it terminates). Dang, pushd/popd are awesome. I'll just save $PWD or whatever, since I only need a one-element "stack". -Paul From komarek at cmu.edu Mon Jun 23 15:49:48 2003 From: komarek at cmu.edu (Paul Komarek) Date: 23 Jun 2003 15:49:48 -0400 Subject: [auton-users] arch*.sh scripts In-Reply-To: References: Message-ID: <1056397788.27584.9.camel@laptop> On Mon, 2003-06-23 at 15:37, Pat Gunn wrote: > > Paul already found one non-standard call ( $() instead of `` - I'd have > > missed this since the FreeBSD sh also happens to support this). Apart from > > that, "make" needs to be "gmake" everywhere. > > > > With this change I can make "sh ../smallbutuseful/archdir.sh" work. > > > > archexe.sh doesn't like the pushd/popd. Maybe just enclose a big chunk in a > > () block (meaning to spawn a subshell for it, which forget all the "cd"s > > you do after it terminates). > > I personally think this is wasted effort -- it makes the script harder > to read, and for very little benefit. Bash is on all facilitized OS's > we need to care about, and is on many other OS's, and is easy to install > elsewhere. I don't think it's at all unreasonable to require it, any more > than requiring that gnumake be installed is unreasonable. I would agree if the changes weren't trivial. Thankfully it appears we can make everyone happy with a few minor changes. -Paul