Thursday, 1 July 2010

make Linux shell executable script in 3 steps!

open new file

syntetik@syntetik-desktop:~/Documents$ gedit my_cmd

1: edit


def main():

print 'hello from my_cmd!'


2: add executable permission

chmod +x my_cmd

get file path by typing pwd

syntetik@syntetik-desktop:~/Documents$ pwd

3: add this path to environment variable

export PATH=$PATH:/home/syntetik/Documents/

now you can run the script as a command

syntetik@syntetik-desktop:~/Documents$ my_cmd
hello from my_cmd!

Post a Comment