Find the answer to your Linux question:
Results 1 to 2 of 2
Ok I know this might be better in the n00b section and I fell like and idiot for asking but I thought I would swallow my pride and ask. When ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie mactruck's Avatar
    Join Date
    Apr 2012
    Location
    City of Salt
    Posts
    185

    running scripts.


    Ok I know this might be better in the n00b section and I fell like and idiot for asking but I thought I would swallow my pride and ask. When I want to run a script at home I first have to tell my system what type of script I am running. If I want to run my ha.sh script I have to type:
    Code:
    bash ha.sh
    Now when I am at work all I would have to type is:
    Code:
    ha.sh
    And the same script will run. Why is it that I have to type bash first? How can I make it so my home computer will know what type of script I am running?

    I do have this as my first line,
    Code:
    #!/bin/bash
    So I thought that would tell my system what to run.

    Help me please.

  2. #2
    Linux Newbie
    Join Date
    Nov 2012
    Posts
    224
    hi,

    I'd feel a bit unsecure at your work, as I've been taught not to adopt this behaviour.

    the usual case is to make your script executable, and call it with absolute path
    Code:
    /home/me/myScript
    or relative path
    Code:
    ./myScript

Posting Permissions

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