![]() |
|
|
#31 |
|
Guest
Posts: n/a
|
Re: Bash script error
on Tuesday 08 January 2008 00:22
in the Usenet newsgroup alt.os.linux.mandriva Doug Laidlaw wrote: > This is from the Creatures Docking Station, which is really too old to > use. > > But for my own knowledge, the bit below gives an error that 'dirname' is > missing an operand; > > if [ "$fullpath" = "" ]; then > fullpath="$1" > fi > # Is the awk/ls magic portable? > if [ -L "$fullpath" ]; then > fullpath="`ls -l "$fullpath" | awk '{print $11}'`" > fi > dirname $fullpath > > Setting a variable like this is common. Why doesn't it work in this > instance? It should ultimately resolve to "dirname $1" or whatever > fullpath is ultimately set at? > > TIA, > > Doug. Try running "bash -euxv <script name>" for some more information. -- sig goes here... Peter D. |
|
|
|
#32 |
|
Guest
Posts: n/a
|
Re: Bash script error
on Tuesday 08 January 2008 00:22
in the Usenet newsgroup alt.os.linux.mandriva Doug Laidlaw wrote: > This is from the Creatures Docking Station, which is really too old to > use. > > But for my own knowledge, the bit below gives an error that 'dirname' is > missing an operand; > > if [ "$fullpath" = "" ]; then > fullpath="$1" > fi > # Is the awk/ls magic portable? > if [ -L "$fullpath" ]; then > fullpath="`ls -l "$fullpath" | awk '{print $11}'`" > fi > dirname $fullpath > > Setting a variable like this is common. Why doesn't it work in this > instance? It should ultimately resolve to "dirname $1" or whatever > fullpath is ultimately set at? > > TIA, > > Doug. Try running "bash -euxv <script name>" for some more information. -- sig goes here... Peter D. |
|
|
|
#33 |
|
Guest
Posts: n/a
|
Re: Bash script error
On Tue, 08 Jan 2008 00:22:56 +1100, Doug Laidlaw wrote:
> This is from the Creatures Docking Station, which is really too old to > use. > > But for my own knowledge, the bit below gives an error that 'dirname' is > missing an operand; > > if [ "$fullpath" = "" ]; then > fullpath="$1" > fi > # Is the awk/ls magic portable? > if [ -L "$fullpath" ]; then > fullpath="`ls -l "$fullpath" | awk '{print $11}'`" > fi > dirname $fullpath > > Setting a variable like this is common. Why doesn't it work in this > instance? It should ultimately resolve to "dirname $1" or whatever > fullpath is ultimately set at? > > TIA, > > Doug. If the dirname is a link. Try changing 11 to 10 in the awk statement. |
|
|
|
#34 |
|
Guest
Posts: n/a
|
Re: Bash script error
On Mon, 07 Jan 2008 22:53:24 +0000, Bit Twister wrote:
> On Mon, 07 Jan 2008 16:33:18 -0600, Jim Whitby wrote: > >> If the dirname is a link. Try changing 11 to 10 in the awk statement. > > and back to 11 if not. ![]() Hmmmm... I just did a quick check. It would appear the awk statement is not portable. In order for it to work here. The real dir is field 10, the link is field 8. eg. lrwxrwxrwx 1 jim jim 13 2007-11-30 21:55 /home/jim/vuse -> /public2/vuse/ __________ _ ___ ___ __ __________ _____ ______________ __ ______________ 1 2 3 4 5 6 7 8 9 10 Given that it appears yours and Doug's is 11, it can't be portable. |
|
|
|
#35 |
|
Guest
Posts: n/a
|
Re: Bash script error
On Mon, 07 Jan 2008 22:53:24 +0000, Bit Twister wrote:
> On Mon, 07 Jan 2008 16:33:18 -0600, Jim Whitby wrote: > >> If the dirname is a link. Try changing 11 to 10 in the awk statement. > > and back to 11 if not. ![]() Hmmmm... I just did a quick check. It would appear the awk statement is not portable. In order for it to work here. The real dir is field 10, the link is field 8. eg. lrwxrwxrwx 1 jim jim 13 2007-11-30 21:55 /home/jim/vuse -> /public2/vuse/ __________ _ ___ ___ __ __________ _____ ______________ __ ______________ 1 2 3 4 5 6 7 8 9 10 Given that it appears yours and Doug's is 11, it can't be portable. |
|
|
|
#36 |
|
Guest
Posts: n/a
|
Re: Bash script error
Bit Twister wrote:
> On Mon, 7 Jan 2008 16:23:40 +0000 (UTC), Bit Twister wrote: > > Opps, >> set - # set debugging mode > set - # set debugging mode off Fair enough, but even the set command has its own problems: /usr/local/bin/dockingstation: line 58: set: -�: invalid option set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...] dirname: missing operand I don't know what character it can see unless it is an extra letter space. The first line in the script is "set -e". I also tried using two hyphens (because of the usage syntax above) and shifting the comments to their own line (and making sure there were no leftover space characters.) Nothing worked. I won't take it any further. I tried "man set" and got a list of Bash built-ins. It would be more convenient for a casual user like me if man bash were broken up into smaller manpages, but I can't argue that one. Doug. |
|
|
|
#37 |
|
Guest
Posts: n/a
|
Re: Bash script error
On Thu, 10 Jan 2008 11:22:04 +1100, Doug Laidlaw wrote:
> Bit Twister wrote: > >> On Mon, 7 Jan 2008 16:23:40 +0000 (UTC), Bit Twister wrote: >> >> Opps, >>> set - # set debugging mode >> set - # set debugging mode off > > > Fair enough, but even the set command has its own problems: > > /usr/local/bin/dockingstation: line 58: set: -�: invalid option ^ Note the funny character------------------------' I tried tab and space tab no errors for me. $ cat aa set -x echo junk set - # debugging off echo junk $ ./aa ++ echo junk junk ++ set - junk [bittwister@wb ~]$ edt aa $ cat aa set -e echo junk set - # debugging off echo junk [bittwister@wb ~]$ ./aa junk junk |
|
|
|
#38 |
|
Guest
Posts: n/a
|
Re: Bash script error
On Thu, 10 Jan 2008 04:34:55 +0000 (UTC), Bit Twister wrote:
>> >> /usr/local/bin/dockingstation: line 58: set: -�: invalid option > ^ > Note the funny character------------------------' Dang it. Character disappears. Using emacs for my editor, it shows a small question mark in my background color in-closed in forground color. |
|
|
|
#39 |
|
Guest
Posts: n/a
|
Re: Bash script error
On Wed, 09 Jan 2008 23:38:57 -0500, Bit Twister <> wrote:
> On Thu, 10 Jan 2008 04:34:55 +0000 (UTC), Bit Twister wrote: >>> /usr/local/bin/dockingstation: line 58: set: -�: invalid option >> Note the funny character------------------------' > Dang it. Character disappears. Using emacs for my editor, it shows a > small question mark in my background color in-closed in forground > color. Copy/pasted the above funny character into a file, and then viewing it it khexedit shows it's a triple byte character, x'ef bf bd'. Very strange. Regards, Dave Hodgins -- Change nomail.afraid.org to ody.ca to reply by email. (nomail.afraid.org has been set up specifically for use in usenet. Feel free to use it yourself.) |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
< Windows Help - MS Office Help - Hardware Support >
| New To Site? | Need Help? |