05-20-2002
Your for statement is already stepping though the args. Don't use "shift" at all in your loop and it should work.
In
your previous thread, I showed you:
for parm ; do
echo $parm is a parameter
done
This will work exactly the same as:
for parm in "$@" ; do
echo $parm is a parameter
done
But you left the quotes off with your loop. If you have a parameter list like:
./script one 222 "333 3333" 4444
that third parameter will be split in two pieces with your loop. You will also have trouble with a null parameter:
./script one 222 "" 4444
To use shift, one way is
while [ $# -gt 0 ] ; do
echo $1 is a parm
shift
done
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi all, when I press SHIFT at once it work like as
I've hold it (like CapsLock is On, but it Off) ! ... and if I press F1 (or another
function key) it put out 24z :(
it is occure on my remote sun 8 , xterm session
help me please ! (2 Replies)
Discussion started by: oneivan
2 Replies
2. Shell Programming and Scripting
Hi Folks,
In shell scripting the maximum no. of command line parameters becomes 9(Am i right). If we want to get more than 9 parameters we use the shift command.
Even here there are two possibilities.
1. Without the use of variables - The arguments are lost and the lost no. is equal to the... (6 Replies)
Discussion started by: Nisha
6 Replies
3. Shell Programming and Scripting
I am running a program where in I have this command
which is giving error the shift: number is not correct.
can you please tell me how shift actually works?
the line which is giving error is-
set $PARAM; shift; shift; shift; shift; shift; shift; shift; shift
Is it related somewhere to... (2 Replies)
Discussion started by: shrao
2 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I wrote one script, in between script needs to use 10th and 11th positional parameters, that time i used "shift". Here i am facing the below find problem,
./DataCount.sh: cannot shift
I tried
1) I have read man pages for shift
2) Before but * and **
3) Simple shift with out giving... (4 Replies)
Discussion started by: Nagapandi
4 Replies
5. Shell Programming and Scripting
I would need the awk command or a better way to get my file that looks like
1234
5678
8912
3456
7890
to look like
1234,5678,8912,3456,7890
Thanks in advance (4 Replies)
Discussion started by: bombcan
4 Replies
6. UNIX for Dummies Questions & Answers
Hi,
Firstly, I did a search for this question both on this site and on the internet and have not been able to find a suitable answer that is not general in nature.
I have always been a Windows user. I use my girl friend's mac every now and then, but I always come back to windows. For a... (1 Reply)
Discussion started by: mearex
1 Replies
7. Shell Programming and Scripting
Hello Expert
Can any one please explain what is the use of shift command in general terms:
set -- $(ls -t)
shift
rm -Rf $*
what is the use of shift command over here.
Thanks a lot for your help (2 Replies)
Discussion started by: aks_1902
2 Replies
8. UNIX for Dummies Questions & Answers
think using shift would help me finish my script but cant get it work without your help. would appreciate if you give me a example with shift & counter in the same script so I can later work on that to my one.
Thanks and Good Luck! (1 Reply)
Discussion started by: me.
1 Replies
9. Shell Programming and Scripting
Hello,
I am reading one of the AIX manuals about shell scripting and (AIX 5) and I found this example when introducing to functions:
function usage
{
prog="$1"; shift
print -u2 "$prog: usage: $prog $@"
exit 1
}
This example is meant to be easy but I don't understand what it is... (5 Replies)
Discussion started by: Kibou
5 Replies
10. Shell Programming and Scripting
#!/bin/bash
hostname=$1; shift
for hostname in $1
do
ping $hostname
done
I want to run the above script as hostname.sh yahoo.com google.com cnn.com. I want to shift each hostname to $1. How can do that with above code as currently it's not shifting. (5 Replies)
Discussion started by: scj2012
5 Replies
LEARN ABOUT REDHAT
xmtransfersetparameters
XmTransferSetParameters(library call) XmTransferSetParameters(library call)
NAME
XmTransferSetParameters -- A toolkit function that establishes parameters to be passed by the next call to XmTransferValue
SYNOPSIS
#include <Xm/Transfer.h>
void XmTransferSetParameters(
XtPointer transfer_id,
XtPointer parm,
int parm_fmt,
unsigned long parm_length,
Atom parm_type);
DESCRIPTION
XmTransferSetParameters establishes a parameter definition. Your application calls XmTransferSetParameters just before calling XmTransfer-
Value, and only if XmTransferValue needs to transfer a value containing a parameter.
transfer_id
Specifies a unique indentifier for the data transfer operation. The value must be the same as the value of the transfer_id mem-
ber of the XmDestinationCallbackStruct passed to the XmNdestinationCallback procedure.
parm Specifies parameters to be passed to the conversion routine (and the XmNconvertCallback procedures, if any) of the widget that
owns the selection. The type and length of parameters are target-specific. If the target takes no parameters, the value is
NULL.
parm_fmt Specifies whether the data in parm should be viewed as a list of 8-bit, 16-bit, or 32-bit quantities. Possible values are 0
(when parm is NULL), 8, 16, and 32.
parm_length
Specifies the number of elements of data in parm, where each element has the number of bits specified by parm_fmt. When parm is
NULL, the value is 0.
parm_type Specifies the type of parm.
RELATED
XmTransferSendRequest(3), XmTransferStartRequest(3), and XmTransferValue(3).
XmTransferSetParameters(library call)