shell scripting languages
Learn from examples
Scripting may be interactive or updating your .bashrc or .cshrc file
There are other shell scripts.
In order to present examples on web page,
the examples are given as text and input files.
1. Get output from shell script or command line, echo
# on the command line or in a shell script, the pound sign #
# makes the rest of a line a comment.
echo "your message" # just prints your message
echo $SHELL # tells you which shell you are using
echo $PATH # tells you all the directories where
# you can execute files with simple command
exss1.r source code
You can define a script that becomes a command. e.g. exss1.sh
Typically some_name.sh yet, needs chmod +x some_name.sh
in order to type command some_name.sh
exss1.sh file is:
# exss1.sh
echo "exss1.sh running"
echo "your message"
echo $SHELL
echo $PATH
running exss1.sh utputs:
exss1.sh running
your message
/bin/csh
.:/home/faculty4/squire/bin:/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/local/bin:/usr/local/X11:/usr/bin/X11:/usr/local/unsupported:/etc:/usr/etc:/cs/bin:/usr/ccs/bin:/local/bin:/usr/sfw/bin:/usr/site/bin:/web/www/help/VHDL/verilog/verilog-0.6.1/driver:/web/www/help/fortran/SML/bin
2. Add alias to .bashrc or .cshrc
# you can type Windows commands in linux, using alias
# you can add any commands you want to have just a short name
in .cshrc
alias del 'rm -f'
alias dir 'ls -ltr' # dir /od * in Windows
alias copy 'cp -p'
alias md mkdir
alias ren mv
alias cdgl "cd /afs/umbc.edu/users/s/q/squire/home"
in .bashrc
alias del='rm -f'
alias dir='ls -ltr' # dir /od * in Windows
alias copy='cp -p'
alias md='mkdir'
alias ren='mv'
alias cdgl='cd /afs/umbc.edu/users/s/q/squire/home'
You may find the system default script as:
/etc/bashrc
/etc/bash.bashrc
/etc/cshrc
/etc/csh.cshrc
One of these, depending on your default setting, is run before
before the .bashrc or .cshrc in your login directory.
Last updated 8/16/2019