How to ignore first or last parameter


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to ignore first or last parameter
# 1  
Old 02-20-2011
How to ignore first or last parameter

Can someone help me of doing something like this

send.sh
Code:
#!/bin/bash

for last; do true; done
echo $* | gammu sendsms TEXT $last

every thing is good except that when i launch the script like this
Code:
./send.sh This is the message i want to send +63922XXXXXXX

it turned out the message of the reciepient is "This is the message i want to send +63922XXXXXXX"

it included the recipient's own number,
i tried using quote but im having problems when im using it of runtime.exec() on java so now im forced to do the script on a series of paramaters using $*

i want something like this to happen, when i execute
Code:
./send.sh This is the message i want to send +63922XXXXXXX

i want to user only to recieve
Code:
"This is the message i want to send" and send it to +63922XXXXXXX

not
Code:
"This is the message i want to send +63922XXXXXXX" and sends to +63922XXXXXXXX


Last edited by Franklin52; 02-21-2011 at 02:57 AM.. Reason: Please use code tags, thank you
# 2  
Old 02-20-2011
Why not:
Code:
./send.sh "This is the message i want to send" +63922XXXXXXX

Then:
Code:
echo "$1" | gammu sendsms TEXT $2

# 3  
Old 02-21-2011
The quotations are being ignored if i used it in java's
runtime.exec() function

BTW case solved thanksSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Call Script with Parameter (that has another parameter)

Hi. How do I achieve this sh /EDWH-DMT02/script/MISC/exec_sql.sh "@/EDWH-DMT02/script/others/CSM_CKC/Complete_List.sql ${file_name}" Complete_List.txt The /EDWH-DMT02/script/MISC/exec_sql.sh has two parameters and it's working fine with this sh /EDWH-DMT02/script/MISC/exec_sql.sh... (7 Replies)
Discussion started by: aimy
7 Replies

2. Shell Programming and Scripting

Resolving a parameter which is passed as parameter

Hi, I have the following files. ->cat scr.sh export TMP_DIR=/home/user/folder1 export TMP_DIR_2=/home/user/folder2 while read line do cat "$line" done<file_list.dat ------------------------ -> cat file_list.dat $TMP_DIR/file1.txt $TMP_DIR_2/file2.txt --------------------------- -> cat... (6 Replies)
Discussion started by: barath
6 Replies

3. Shell Programming and Scripting

How to get the parameter value from the parameter file in perl?

hi all, i have a parameter file of following format, i want a method which can get the value of specific parameter. parameter file format: <Parameter Name="FileLocationWindows"> <Description> The directory location of the logger file. ... (1 Reply)
Discussion started by: laxmikant.hcl
1 Replies

4. Shell Programming and Scripting

Passing parameter to script, and split the parameter

i am passing input parameter 'one_two' to the script , the script output should display the result as below one_1two one_2two one_3two if then echo " Usage : <$0> <DATABASE> " exit 0 else for DB in 1 2 3 do DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}` done fi (5 Replies)
Discussion started by: only4satish
5 Replies

5. Shell Programming and Scripting

Command that takes one parameter and then searches for the passed in parameter

Hi I am looking for a unix command or a small shell script which can takes one parameter and then searches for the passed in the parameter in any or all files under say /home/dev/ Can anyone please help me on this? (3 Replies)
Discussion started by: pankaj80
3 Replies

6. Shell Programming and Scripting

Any one here this moment? (Ignore)

I have small question i should solve it (1 Reply)
Discussion started by: Ame
1 Replies

7. Shell Programming and Scripting

ls ignore pattern

Hi, I have a FTP script that check for ".done" files in the remote path and the "get" the corresponding data files. Here's how it does..... First it list all the *.done file as below: ls *.done And then it picks one file and get the corresponding data file. After that it... (3 Replies)
Discussion started by: dips_ag
3 Replies

8. UNIX for Dummies Questions & Answers

please ignore this....

Most of the people think that they can not use Unix as desktop. By this poll we gone tell them that we not just use Unix as desktop but also love different display managers like GNOME, KDE etc..... (1 Reply)
Discussion started by: ynilesh
1 Replies

9. Shell Programming and Scripting

How to ignore '.' files

I'm running Fedora Core 6 as an FTP server on a powerMac G4... I'm trying to create a script to remove files older than 3 days... I'm able to find all data older than 3 days but it finds hidden files such as /home/ftp/goossens/.canna /home/ftp/goossens/.kde... (4 Replies)
Discussion started by: James_UK
4 Replies

10. Shell Programming and Scripting

how do I make dynamic parameter names? Or get the value of a parameter evaluated twi

Say I write something like the following: var1=1 var2=2 for int in 1 2 do echo "\$var$int" done I want the output to be: 1 2 Instead I get something like: $var1 $var2 (2 Replies)
Discussion started by: Awanka
2 Replies
Login or Register to Ask a Question