[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: crontab hour range 6-midnight



Bob Proulx wrote:
> Jochen Spieker wrote:
> > Bob Proulx:
> > > Having a literal '~/' in there works for bash.  But it doesn't work
> > > for /bin/sh linked to dash for example.
> > 
> > Works here:
> > 
> > $ exec /bin/dash
> > $ cd /
> > $ pwd
> > /
> > $ cd ~
> > $ pwd
> > /home/jrschulz
> 
> But that doesn't have anything to do with PATH.  You didn't test PATH
> containing "~/" in it.  You tested cd with "~" as an option argument.
> Those are different things.
> 
> If you want to test PATH with "~/" in it then here is a test for it.
> It must be two process layers deep.  It must launch a non-bash process
> which itself launches a process.  It must not be a bash script.

Silly me!  Here is an even simpler test.

  $ mkdir -p $HOME/bin

  $ cat >$HOME/bin/pathtrial1 <<\EOF
#!/bin/sh
echo hello from pathtrial1
EOF
  $ chmod a+x $HOME/bin/pathtrial1
  $ pathtrial1
  hello from pathtrial1

That sets up the test as before.  Then simply start up dash with that PATH.

I use 'env' here as the portable way to invoke a command with a
specified environment but avoiding shell aliases and so forth and
regardless of your shell being csh or some such.

  $ env PATH='~/bin:/usr/bin:/bin' /bin/dash

Then try calling programs from $HOME/bin.  They won't be found.

  $ pathtrial1
  /bin/dash: 1: pathtrial1: not found

  $ echo $PATH
  ~/bin:/usr/bin:/bin

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: