Home » Infrastructure » Unix » Urgent solution required
Urgent solution required [message #98575] Tue, 11 January 2005 23:09 Go to next message
Naveen Verma
Messages: 60
Registered: August 2004
Member
What do we mean by ${1#-} in Kshell? How it is different from $1, the positional parameter?
Re: Urgent solution required [message #98576 is a reply to message #98575] Wed, 12 January 2005 02:33 Go to previous message
Frank Naude
Messages: 4566
Registered: April 1998
Senior Member
See the ksh man page:

${parameter#word}
           Remove Smallest  Prefix  Pattern.  The  word  will  be
           expanded to produce a pattern. The parameter expansion
           then will result in parameter, with the smallest  por-
           tion of the prefix matched by the pattern deleted.


Here is an example:

$ export X=-string
$ echo $X
-string
$ echo ${X#-}
string


Best regards.

Frank
Previous Topic: Write to Unix/Linux FIFO
Next Topic: Unix-vs-Linux
Goto Forum:
  


Current Time: Sat Jan 16 12:59:50 CST 2021