[prev in list] [next in list] [prev in thread] [next in thread]
List: linuxap-dev
Subject: Re: [LinuxAP-dev] Re: http scripts
From: "Glenn Engel at Home" <glenne () engel ! org>
Date: 2003-01-10 16:38:38
[Download RAW message or body]
Note that you can use the shell substitution syntax to do this if items
are delimited by a character not contained within one of the arguments.
${list#* } #remove thru first space
repeat the above n times and then remove trailing items with
${list%% *}
Make this a function and no sub-shells needed either.
Keith E Smith said:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
>
> Keith E Smith wrote:
> | |> # cat /usr/bin/expr
> | | #!/bin/ash
> | | if [ -z "$3" ]
> | | then
> | | echo "Usage: $0 number oper number"
> | | exit 1
> | | fi
> | | dc "$1" "$3" "$2" | cut -d"." -f1
> | |
> | | Cheers
> |
> | so 1 + 1 comes in. The quotes are irrelevant, we end up with:
> |
> | dc 1 1 + | cut -d"." -f1
> |
> | [keith@tempe] /home/keith<313>ash
> | $ dc 1 1 + | cut -d"." -f1
> | Could not open file 1: No such file or directory
> |
> | Perhaps something I missed, don't see where you are popping the stack
>
> Not to be obnoxious but I've used dc in the past, switch to expr for
> capability reasons looong ago:
>
> echo "$1" "$3" "$2" p | dc works.
>
> What's with the 'cut'? Is there a busybox'ism going down here?
>
> - --
> Keith Smith keith@ksmith.com
> 655 W Fremont Dr
> Tempe AZ 85282 it's hot
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org
>
> iD8DBQE+HmHvz2CugoiX+Q0RAksqAJ9P5t9WmqW0RptT1SaS7icidl126wCeIAHN
> 8J8dQ1GUkKKJ00UC70PYj5s=
> =GjLr
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> LinuxAP-dev mailing list
> LinuxAP-dev@linuxAP.ksmith.com
> http://linuxAP.ksmith.com/mailman/listinfo/linuxap-dev
--
Glenn
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic