Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #173388

Re: My bash script is missing something - what?

From "Thomas Schmitt" <scdbackup@gmx.net>
Newsgroups linux.debian.user
Subject Re: My bash script is missing something - what?
Date 2016-10-10 15:40 +0200
Message-ID <sqIYa-1PF-31@gated-at.bofh.it> (permalink)
References <sqIEO-1J7-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

Richard Owlett wrote:
> > >      bash: test.sh: command not found

Robert Parker wrote:
> > you need to do:./test.sh

Richard Owlett wrote:
> That just fails differently by responding:
> : No such file or directory
> At the moment I using
>   http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_01.html

It states
  "If you did not put the scripts directory in your PATH, and . (the
   current directory) is not in the PATH either, you can activate the
   script like this:

     ./script_name.sh 
  "

So on the first hand it was about the environment variable named "PATH".
Do

  echo $PATH

to get a list of directories where programs will be found automatically.
The directory paths are separated by ':' characters. E.g.

  /usr/local/bin:/usr/bin:/usr/local/games:/usr/games:/home/thomas/bin

----------------------------------------------------------------------

But what does now prevent proper execution ?

I tested the script as shown by you. It works and says

  8.X
  /dev/sdaY on / type ext4 (rw,noatime,discard,errors=remount-ro,data=ordered)

(with X and Y being private numbers. :))

So this must be some flaw hidden from the human eye and copy+paste.

Be so kind and let program "od" show the bytes of your script.

  od -c test.sh

For me it says

  0000000   #   !   /   b   i   n   /   b   a   s   h  \n   c   a   t    
  0000020   /   e   t   c   /   d   e   b   i   a   n   _   v   e   r   s
  0000040   i   o   n  \n   m   o   u   n   t       |       g   r   e   p
  0000060       '   o   n       /       '  \n  \n
  0000072

This should show us any CarriageReturn characters, which Greg suspects
to be to blame.


Lars Norden wrote:
>         #!/bin/bash -x

Good proposal, too.
(I would have proposed command

   set -x

as second line of the script.)


Have a nice day :)

Thomas

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

My bash script is missing something - what? Richard Owlett <rowlett@cloud85.net> - 2016-10-10 15:00 +0200
  Re: My bash script is missing something - what? Robert Parker <rlp1938@gmail.com> - 2016-10-10 15:10 +0200
    Re: My bash script is missing something - what? Richard Owlett <rowlett@cloud85.net> - 2016-10-10 15:20 +0200
      Re: My bash script is missing something - what? Robert Parker <rlp1938@gmail.com> - 2016-10-10 15:30 +0200
      Re: My bash script is missing something - what? Greg Wooledge <wooledg@eeg.ccf.org> - 2016-10-10 15:30 +0200
        Re: My bash script is missing something - what? Greg Wooledge <wooledg@eeg.ccf.org> - 2016-10-10 16:20 +0200
        Re: My bash script is missing something - what? Nicolas George <george@nsup.org> - 2016-10-10 16:20 +0200
        PROGRESS - was [Re: My bash script is missing something - what?] Richard Owlett <rowlett@cloud85.net> - 2016-10-10 17:00 +0200
          Re: PROGRESS - was [Re: My bash script is missing something - what?] Nicolas George <george@nsup.org> - 2016-10-10 17:10 +0200
            Re: PROGRESS - was [Re: My bash script is missing something - what?] Richard Owlett <rowlett@cloud85.net> - 2016-10-10 17:50 +0200
              Re: PROGRESS - was [Re: My bash script is missing something - what?] Peter Hillier-Brook <phb@hbsys.plus.com> - 2016-10-10 18:30 +0200
                Re: PROGRESS - was [Re: My bash script is missing something - what?] Greg Wooledge <wooledg@eeg.ccf.org> - 2016-10-10 18:40 +0200
          Re: PROGRESS - was [Re: My bash script is missing something - what?] Greg Wooledge <wooledg@eeg.ccf.org> - 2016-10-10 17:10 +0200
            Re: PROGRESS - was [Re: My bash script is missing something - what?] Richard Owlett <rowlett@cloud85.net> - 2016-10-10 17:50 +0200
      Re: My bash script is missing something - what? Lars Noodén <lars.nooden@gmail.com> - 2016-10-10 15:30 +0200
      Re: My bash script is missing something - what? "Thomas Schmitt" <scdbackup@gmx.net> - 2016-10-10 15:40 +0200
  Re: My bash script is missing something - what? Greg Wooledge <wooledg@eeg.ccf.org> - 2016-10-10 18:00 +0200
  Re: My bash script is missing something - what? songbird <songbird@anthive.com> - 2016-10-10 18:00 +0200

csiph-web