Re: Substring search in dash [ _NOT_ bash ] shell

2016-09-27 Thread Thomas Schmitt
Hi, Greg Wooledge wrote: > https://lists.gnu.org/archive/html/bug-bash/2015-07/msg00125.html which states $ test -n '<' -a true -bash: test: too many arguments This looks rather like the effect of having an operator named '<': $ test 1 '<' 2 && echo yes yes $ test 3 '<' 2 && echo yes

Re: Substring search in dash [ _NOT_ bash ] shell

2016-09-27 Thread Greg Wooledge
On Tue, Sep 27, 2016 at 05:05:08PM +0200, Thomas Schmitt wrote: > Greg Wooledge wrote: > > Do not use -o and -a in a test command. > > http://mywiki.wooledge.org/BashPitfalls#pf6 > > As if anybody would dare to touch the old "test" command. :)) > > Rather i avoid "[" brackets, not to allow any im

Re: Substring search in dash [ _NOT_ bash ] shell

2016-09-27 Thread Thomas Schmitt
Hi, i wrote: > > if you cannot find a dash tutorial then get a tutorial for bash or sh and > > test in dash whether the proposals apply properly. Greg Wooledge wrote: > First, there are more bad tutorials out there in the wild than good > tutorials, by at least one order of magnitude. But the c

Re: Substring search in dash [ _NOT_ bash ] shell

2016-09-27 Thread Greg Wooledge
On Tue, Sep 27, 2016 at 10:07:14AM +0200, Thomas Schmitt wrote: > if you cannot find a dash tutorial then get a tutorial for bash or sh and > test in dash whether the proposals apply properly. This is potentially bad advice, for several reasons. First, there are more bad tutorials out there in t

Re: Substring search in dash [ _NOT_ bash ] shell

2016-09-27 Thread Thomas Schmitt
Hi, for a moment, my fingers were faster than my brain. I wrote: > The "test" expression used is "A = B". There are operators like "-o" for > logical "or". "A -o B" is true if a is true, or if be is true, or both are > true. Translation via brain: The "test" expression used is "`hostname`" =

Re: Substring search in dash [ _NOT_ bash ] shell

2016-09-27 Thread Thomas Schmitt
Hi, if you cannot find a dash tutorial then get a tutorial for bash or sh and test in dash whether the proposals apply properly. (You can reach dash in dialog by typing "dash" into a bash window.) Bash and dash both stem from S.R.Bourne's sh. The shell chapters of his book "The Unix System" from

Re: Substring search in dash [ _NOT_ bash ] shell

2016-09-27 Thread David
On 27 September 2016 at 13:49, Richard Owlett wrote: > On 9/26/2016 10:42 AM, Greg Wooledge wrote: >> On Mon, Sep 26, 2016 at 10:39:59AM -0500, Richard Owlett wrote: >>> >>> # string if [ "`hostname`" = bob ]; then echo bob.cfg; fi >>> >>> I need for the case when evaluates to marybobsam . >>

Re: Substring search in dash [ _NOT_ bash ] shell

2016-09-26 Thread The Wanderer
On 2016-09-26 at 23:49, Richard Owlett wrote: > On 9/26/2016 10:42 AM, Greg Wooledge wrote: > >> On Mon, Sep 26, 2016 at 10:39:59AM -0500, Richard Owlett wrote: >> >>> # string if [ "`hostname`" = bob ]; then echo bob.cfg; fi >>> >>> I need for the case when evaluates to marybobsam . >>> I ca

Re: Substring search in dash [ _NOT_ bash ] shell

2016-09-26 Thread Richard Owlett
On 9/26/2016 10:42 AM, Greg Wooledge wrote: On Mon, Sep 26, 2016 at 10:39:59AM -0500, Richard Owlett wrote: # string if [ "`hostname`" = bob ]; then echo bob.cfg; fi I need for the case when evaluates to marybobsam . I can find examples in bash shell, but I need dash. Are you asking how

Re: Substring search in dash [ _NOT_ bash ] shell

2016-09-26 Thread Greg Wooledge
On Mon, Sep 26, 2016 at 10:39:59AM -0500, Richard Owlett wrote: > # string if [ "`hostname`" = bob ]; then echo bob.cfg; fi > > I need for the case when evaluates to marybobsam . > I can find examples in bash shell, but I need dash. Are you asking how to check for the substring "bob" in your

Substring search in dash [ _NOT_ bash ] shell

2016-09-26 Thread Richard Owlett
The Installation Manual in _B.5.3. Chainloading preconfiguration files_ says in part: # More flexibly, this runs a shell command and if it outputs the names of # preconfiguration files, includes those files. #d-i preseed/include_command \ # string if [ "`hostname`" = bob ]; then echo bob.cf