LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 04-05-2004, 07:56 PM   #1
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" ( being the shell script.) With a batch file I would just use:

COPY %1 ~/bkg.jpg

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

Old 04-05-2004, 08:36 PM   #2
Registered: Aug 2002
Posts: 13,455

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

Rep: Reputation: 45
%1 = $1
Old 04-05-2004, 10:08 PM   #4
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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:44 PM
Passing parameters to bash script Kamikazee Programming 4 10-01-2005 07:41 AM
passing parameters to functions in shell script kushalkoolwal Programming 1 09-28-2005 03:40 PM
Bash Script Passing variable to Function nutthick Programming 2 02-02-2005 06:15 AM
passing java parameters to a unix script nephilim Programming 25 10-22-2003 11:51 AM

All times are GMT -5. The time now is 05:20 PM.

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