bash: shell functions - Run your functions in the shell environment.



  • Take into account the main readme for this section. README first.

    If your commands are not long an alias might be more suitable. This is just to demo the ability to read in functions into the shell environment.

    I have my functions defined in a file called test.sh

    my_status () {
      w|head -1
    }
    
    home_space () {
      top -u training
    }
    

    Read in functions from a file into the shell environment.

    $ . ./test.sh
    
    $ my_status
     09:38:37 up 44 min,  2 users,  load average: 0.01, 0.03, 0.11
    

Log in to reply
 

© Lightnetics 2024