LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Passing Parameters to Bash Script (https://www.linuxquestions.org/questions/linux-software-2/passing-parameters-to-bash-script-166622/)

mooreted 04-05-2004 06:56 PM

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.

michaelk 04-05-2004 07:36 PM

Have you googled for BASH script programming yet? There is lots of info on the web.

mikshaw 04-05-2004 07:47 PM

%1 = $1

mooreted 04-05-2004 09:08 PM

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.


All times are GMT -5. The time now is 02:28 PM.