Link to home
Start Free TrialLog in
Avatar of tecumsehjoe
tecumsehjoe

asked on

create script

i want to create a script that will aid in automating bash commands, such as making directories, changing permissions, moving files, etc...  

How do I do this?  I am under the impression I need to make an executable file that contains these commands, but what else needs to be done?  Is there some special syntax in the file or something else?  Any links, refrences, hints?
ASKER CERTIFIED SOLUTION
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of owensleftfoot
owensleftfoot

I would use aliases for this rather that individual scripts. Edit .bashrc in your home directory and add any aliases you like. They wont  work until you open a new shell or run source .bashrc. A couple of examples that I use -
alias xe="chmod +x"
alias log="cd /var/log"
alias mes="less /var/log/messages"
alias erc ="vi ~/.bashrc;source ~/.bashrc"
xe myfile will make myfile executable. log will change to the /var/log directory etc. You can alias several comands by putting a ; between them. I would only use scripts for more complex tasks.