Find the answer to your Linux question:
Results 1 to 2 of 2
I am trying to write a script to move a file to another directory. I need to be able to run the script like so. sh scriptname filename Example: sh ...
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    3

    Script problem

    I am trying to write a script to move a file to another directory.

    I need to be able to run the script like so.

    sh scriptname filename

    Example:

    sh script1 lights

    I am having difficulty getting the file i entered (lights)to be stored as a useable name like filename to move the file.

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    Google > Bash Scripting

    Positional parameters

    Arguments passed to the script from the command line [1] : $0, $1, $2, $3 . . .

    $0 is the name of the script itself, $1 is the first argument, $2 the second, $3 the third, and so forth.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...