Re: Problem with small script

2016-02-18 Thread balducci
> On Thu, Feb 18, 2016 at 11:06:37PM +0700, Robert Parker wrote: > > The script: > > #/bin/bash ^ missing ! here typo in the shebang? > > # testlink.sh > > # must be run as root > > > > file1="$1" > > shift > > mandir=/usr/local/share/man/man3/ > > cp "$file1" "$mandir" > > cd "$mandir" >

Re: Problem with small script

2016-02-18 Thread Robert Parker
On Fri, Feb 19, 2016 at 12:45 AM, Greg Wooledge wrote: > On Thu, Feb 18, 2016 at 05:58:28PM +0100, baldu...@units.it wrote: > > > On Thu, Feb 18, 2016 at 11:06:37PM +0700, Robert Parker wrote: > > > > The script: > > > > #/bin/bash > > ^ missing ! here > > > > typo in the shebang? > > Yes, n

Re: Problem with small script

2016-02-18 Thread Greg Wooledge
On Thu, Feb 18, 2016 at 05:58:28PM +0100, baldu...@units.it wrote: > > On Thu, Feb 18, 2016 at 11:06:37PM +0700, Robert Parker wrote: > > > The script: > > > #/bin/bash > ^ missing ! here > > typo in the shebang? Yes, nicely done. I missed that. On Fri, Feb 19, 2016 at 12:22:20AM +0700, R

Re: Problem with small script

2016-02-18 Thread Robert Parker
On Thu, Feb 18, 2016 at 11:30 PM, Greg Wooledge wrote: > On Thu, Feb 18, 2016 at 11:06:37PM +0700, Robert Parker wrote: > > The script: > > #/bin/bash > > # testlink.sh > > # must be run as root > > > > file1="$1" > > shift > > mandir=/usr/local/share/man/man3/ > > cp "$file1" "$mandir" > > cd "$

Re: Problem with small script

2016-02-18 Thread Greg Wooledge
On Thu, Feb 18, 2016 at 11:06:37PM +0700, Robert Parker wrote: > The script: > #/bin/bash > # testlink.sh > # must be run as root > > file1="$1" > shift > mandir=/usr/local/share/man/man3/ > cp "$file1" "$mandir" > cd "$mandir" You MUST check the result of cd. If it fails but you continue on, yo

Problem with small script

2016-02-18 Thread Robert Parker
The script: #/bin/bash # testlink.sh # must be run as root file1="$1" shift mandir=/usr/local/share/man/man3/ cp "$file1" "$mandir" cd "$mandir" echo '$hash = '"$#" while (( "$#" )); do file2="$1" ln "$file1" "$file2" shift done Results: >> sudo ./testlink.sh readfile.3 readtextfile.3