[PLUG] bash question

Lancashire, Pete plancashire at ci.portland.or.us
Wed May 3 20:45:10 UTC 2006


well i'm stumped

i have a script where I want to do a string function on
the last remaining comamnd line argument

>foobar abcd

#!/bin/bash

#this works ...
arg=$@           # get the argument
first=${arg:0:1} # get one character, starting at the first
echo "first:$first"

#make it all on one line ... does not work
first=${@:0:1}   # bad subsitution

what am I doing wrong ? Tried a zillon different ways
to get the subsitution correct.

-pete





> -----Original Message-----
> From: David Fetter [mailto:david.fetter at fetterconsulting.com]
> Sent: Wednesday, May 03, 2006 1:06 PM
> To: plug at lists.pdxlinux.org
> Subject: Re: [PLUG] To my fellow commies ....
> 
> 
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
> 



More information about the PLUG mailing list