LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-05-2004, 06:56 PM   #1
mooreted
Member
 
Registered: May 2003
Posts: 598

Rep: Reputation: 30
Passing Parameters to Bash Script


I want to copy a file to a particular location. The location remains the same but the file is always different. I have to type "cp image.jpg ~/bkg.jpg." I would like to just type somehing like "icopy image.jpg" (icopy.sh being the shell script.) With a batch file I would just use:

ECHO OFF
CLS
COPY %1 ~/bkg.jpg

What takes the place of "%1" in bash programming?

Ted.
 
Old 04-05-2004, 07:36 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Have you googled for BASH script programming yet? There is lots of info on the web.
 
Old 04-05-2004, 07:47 PM   #3
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
%1 = $1
 
Old 04-05-2004, 09:08 PM   #4
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
To: michaelk,
Yes I have googled Bash programming, there is some in both of my Linux books also, but sometimes there is too much information. I spent an hour trying to find out then decided to ask here. I always wonder at people who ask if I have googled yet. This is, after all, a forum all about answering questions rather than avoiding them. When someone asks me a question, I answer it if I have the ability to do so, and pass it by if I don't. I am not flaming you; just trying to get you to think.

To: mikshaw,
Thank you very much for your succinct answer; I will put it to use immediately.

Have a good day.

Ted.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameters to a shell script neocookie Linux - General 5 10-20-2005 11:44 AM
Passing parameters to bash script Kamikazee Programming 4 10-01-2005 06:41 AM
passing parameters to functions in shell script kushalkoolwal Programming 1 09-28-2005 02:40 PM
Bash Script Passing variable to Function nutthick Programming 2 02-02-2005 05:15 AM
passing java parameters to a unix script nephilim Programming 25 10-22-2003 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration