User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,448 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,675 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 936 | Replies: 1
Reply
Join Date: Aug 2007
Posts: 4
Reputation: shyamalaa is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
shyamalaa shyamalaa is offline Offline
Newbie Poster

Problem with interpretation of the command line arguments in the script

  #1  
Aug 22nd, 2007
I hve code like

echo $1
echo $2

and am executing the code as ./script.sh /home/*.txt /home/*.xsd
The corresponding .txt files and .xsd files of the directory are getting substitued as the command line argument .

and it prints smething like
data.txt
value.xsd

Apart frm using *
if i use anything else it works fine . But my requirement is to pass it in this format in the command line ...

Am completely new to shell scripting ....Pls Help me ...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 1,509
Reputation: masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light 
Rep Power: 10
Solved Threads: 136
masijade's Avatar
masijade masijade is offline Offline
Posting Virtuoso

Re: Problem with interpretation of the command line arguments in the script

  #2  
Aug 22nd, 2007
Because the shell will automatically expand those filename expansion characters before passing the arguments to the script. You might try using \* instead of *, but then, don't expect that the * will work as designed later (it may, then again it may not, I have not tried to "mask" the file expansion during initialisation then using it later).
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 1:53 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC