Terminal commands

Discussion in 'macOS' started by dhokes, Oct 21, 2013.

  1. dhokes macrumors regular

    Joined:
    Dec 5, 2012
    #1
    I'm trying to learn to write shell scripts and use the Terminal.

    In Users/user/Development/linux I've got a script called sysinfo_page.

    So I'm in the linux folder in the terminal and I can see the sysinfo_page when I type the ls command.

    However, when I enter the following command:
    sysinfo_page > sysinfo_page.html

    I receive the following message:
    -bash: sysinfo_page: command not found

    How do I resolve this?
     
  2. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #2
    Did you set the permissions to exectuable? I usually need to execute a script by the following convention ./sysinfo_page > sysinfo_page.html
     
  3. dhokes thread starter macrumors regular

    Joined:
    Dec 5, 2012
    #3
    If I type the following command, I receive a Permission denied message.

    I think I need to add the directory to the PATH? But I'm unsure why/how to do it?
     
  4. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #4
    do a ls -al in the directory that holds your scripts and paste the results.
     
  5. dhokes thread starter macrumors regular

    Joined:
    Dec 5, 2012
    #5
    I managed to do what I wanted by:

    chmod +x sysinfo_page
    ./sysinfo_page > sysinfo_page.html
     
  6. sjinsjca macrumors 68000

    sjinsjca

    Joined:
    Oct 30, 2008
    #6
    Eh? What's a "linux" folder doing in OS X?
     
  7. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #7
    That's why I asked about execution permissions ;)

    Glad you sorted it out
     

Share This Page