.profile command alias

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bilibytes
    New Member
    • Jun 2008
    • 128

    .profile command alias

    Hi,

    i am using a unix system and have made a .profile file to declare custom commands.
    I did this by typing in that file functions like this:

    Code:
    showAllFiles(){
        defaults write com.apple.finder AppleShowAllFiles $1
        killall Finder
    }
    where $1 can be set to true or false by calling this alias like this:

    ~user$: showAllFiles true

    but now i want to be able to create commands with multiple parameters but i don't know how to do it, i would like something like the following:

    Code:
    cpFileToHtdocs(){
    sudo cp -i /Users/user/Documents/Projects/applicationX/code/$1
    /usr/local/apache2/htdocs/applicationX/$2
    }
    i would like to be able to specify two different parameters for that command like this:

    ~user$: cpFileToHtdocs /from/path /to/other/path

    /from/path => $1

    /to/other/path => $2


    if you know how to do that, i would be very pleased to hear about it,

    Thank you very much

    Regards
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    And the way you posted here doesn't work?

    I guess, me might need some more information - what shell are you using for example? (You should be able to get that information by calling echo $SHELL, if your Unix is anything like Linux - which it probably is.) From what I've read, it might well be korn, but it's better to make sure. If it is korn, this tutorial (especially Listing 15) should be helpful.

    Greetings,
    Nepomuk

    Comment

    • bilibytes
      New Member
      • Jun 2008
      • 128

      #3
      Originally posted by Nepomuk
      And the way you posted here doesn't work?

      I guess, me might need some more information - what shell are you using for example? (You should be able to get that information by calling echo $SHELL, if your Unix is anything like Linux - which it probably is.) From what I've read, it might well be korn, but it's better to make sure. If it is korn, this tutorial (especially Listing 15) should be helpful.

      Greetings,
      Nepomuk
      Hi thanks for replying!

      no, i'm using mac os x with GNU bash shell.
      korn is not preinstalled on mac.

      ok now that I know my shell name, i'll google to find it out

      Thankyou again

      regards

      bilibytes

      Comment

      • bilibytes
        New Member
        • Jun 2008
        • 128

        #4
        here is the answer:

        Comment

        • Nepomuk
          Recognized Expert Specialist
          • Aug 2007
          • 3111

          #5
          Glad that you got it working!

          Greetings,
          Nepomuk

          EDIT: As this is a Mac OS X question and we have a Mac OS X Forum, I'll move it there, but leave a redirect in the Unix / Linux Forum.

          Comment

          Working...