Author Topic: Linux cshell programming question  (Read 3662 times)

incognito

  • In the Abis
  • Jackass IV
  • Posts: 544
  • Karma: +15/-20
Linux cshell programming question
« on: January 08, 2006, 06:26:41 PM »
cp $1 /tmp/tempfile.$$

This will create a file whose name is something like /tmp/tempfile.14506, if
the pid number is 14506.



I don't understand this very much, why do we add $1 to it? I know $$ prints out the current PID of the process.

As you can see I am not very familiar with shell programming.
« Last Edit: January 08, 2006, 07:51:13 PM by incognito »

incognito

  • In the Abis
  • Jackass IV
  • Posts: 544
  • Karma: +15/-20
Linux cshell programming question
« Reply #1 on: January 08, 2006, 06:29:23 PM »
Am thinking this says...

pass /tmp/tempfile.$$ AS it's first and only parameter to cp,

am i wrong?
« Last Edit: January 08, 2006, 07:44:37 PM by incognito »

webwhy

  • Jackass IV
  • Posts: 608
  • Karma: +15/-10
Linux cshell programming question
« Reply #2 on: January 08, 2006, 08:48:17 PM »
it refers to the first command line argument of the script

Rob

  • New improved. Now with added something...
  • Jackass In Charge
  • Posts: 5959
  • Karma: +86/-149
  • Approaching 60 from the wrong damn direction...
Linux cshell programming question
« Reply #3 on: January 09, 2006, 02:16:27 AM »
Moved to programming...