what is it called?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting what is it called?
# 1  
Old 05-11-2009
what is it called?

Hey,

I've come across and have used things like:
fase1=${QUERY_STRING%%&*}
and I was wondering what this kind of actions is called? (I'm talking about the % and # operators on strings) Does anyone know where i can find more info about it? It looks like a very powerful tool...

Regards,
Karel
# 2  
Old 05-11-2009
in your 'man ksh' search for 'Parameter expansion':
Code:
     ${parameter%word}
           Remove Smallest  Suffix  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 suffix matched by the pattern deleted.

     ${parameter%%word}
           Remove  Largest  Suffix  Pattern.  The  word  will  be
           expanded to produce a pattern. The parameter expansion
           then will result in parameter, with the  largest  por-
           tion of the suffix matched by the pattern deleted.

     ${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.

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

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Function getting called recursively

I have the below script which creates a directory or simply terminates without throwing error (exit 1) incase the directory exists. bash-4.1$ vi mdir.sh #!/bin/bash -e shopt -s expand_aliases alias mkdir=mkdir_s mkdir_s(){ if ]; then echo " directory EXISTS " return else echo "... (3 Replies)
Discussion started by: mohtashims
3 Replies

2. HP-UX

What is this shell called ?

:wall:What is this shell called ? "/sbin/sh" When I run "echo $SHELL" command on my HP-UX,I get above output. In Linux It was "/bin/bash". Which is bash shell. (5 Replies)
Discussion started by: manalisharmabe
5 Replies

3. UNIX for Dummies Questions & Answers

create a file called -a

Can I create a file called '-a' in unix.Or can i open it with vi ? vi \-a will give u an error that -a is invalid option for vi. (2 Replies)
Discussion started by: Swayam
2 Replies

4. UNIX for Dummies Questions & Answers

how unix called as secure

hi .. This is sanjeev , new at the world of unix , i want to know why unix/linux is called as secure ? as i am new , please suggest me what os i should use ? i am having laptop of 256 ram . thanks in advance regards sanjeev (5 Replies)
Discussion started by: sanjeev1
5 Replies

5. Shell Programming and Scripting

Remove a file called -r using rm

Is there any way to remove a file named "-r" using "rm", because "rm" assumes that file is one of it's options if I type "rm -r" and then throws an error message? I also tried "rm -r -r" and that didn't work either. (3 Replies)
Discussion started by: dkieran
3 Replies

6. UNIX for Dummies Questions & Answers

Help I've created a dir called /

OK, I had some odd characters in my mkdir command which resulted in the following directory getting created: drwxr-xr-x 2 fred fredgroup 512 Apr 12 16:52 / Any ideas how I get rid of it safely? Interestingly that's a straight cut'n'paste and there appear to be some odd... (4 Replies)
Discussion started by: pondlife
4 Replies

7. Shell Programming and Scripting

How to determine the script is called from CRON?

Hello expert, What I want is to determine whether the script is called from CRON or it is executed interactively? I tried the following but no luck: #!/bin/ksh cronID=`pgrep -x cron` GPID=`ps -ef -o ppid,pid | grep " $PPID$" | awk '{print $1}'` if ; then echo I am being run... (15 Replies)
Discussion started by: wes_brooks
15 Replies

8. Shell Programming and Scripting

Procedures are not called ?

My shell script is executing i am having no syntax errors or other errors. When i am testing the shell script i am having a problem that the procedure Prompt, Environment,List are not found. I defined all these procedures in the shell script. Environment() { FULL=N export FULL LOGON=cat... (2 Replies)
Discussion started by: dreams5617
2 Replies

9. Programming

How to get exit value of an executable that gets called from function?

How to get exit value of an executable that gets called from function? I have an executable called “myexec” which returns 0 on success and different values for different fail scenarios. I need to call this (myexec) executable from “myprog()” function of other executable and get the exit value... (1 Reply)
Discussion started by: sureshreddi_ps
1 Replies
Login or Register to Ask a Question