my first bash shell function doesn't work -
i tried 3 internet examples write bashe shell function , call via xterm terminal no success.
1-my functions saved in file "example" , file inexecutable mode.
2-inside example file wrote:
#!/bin/bash function quit { exit } function hello { echo hello! }
3- in xterm terminal, in folder file located called these 2 functions in these ways:
$./quit $./hello
and in way:
$quit $hello
none of them work.but if change following function script (without function word) , call file, works.
any idea, going on?
thanks
you need source script load function definitions current shell environment:
# source script . example # call function hello # call function quit
Comments
Post a Comment