open-discussion
open-discussion > bash shell definition script
Jan 19, 2011 04:01 PM | Joseph Mandeville
bash shell definition script
In the distributions to date, a script "define-jip.tcsh" is
included.
To use this script successfully, one must be working in the tcsh shell.
If you are not using this shell, you have two options:
1) Switch to tcsh like this ("%" represents the Unix/Linux prompt):
% tcsh
% define-jip.tcsh
... or put these definitions into your .cshrc startup file. Use any argument to suppress output:
source absolute_path/define-jip.tcsh 1
2) Modify the script for your particular Unix/Linux shell. For example, a bash script is shown
below. You must SOURCE this script, like this:
source define-jip.bash
but NOT like this:
./define-jip.bash
The latter method only creates temporary definitions in the scripting shell, not the working shell.
As with define-jip.tcsh, you can put this into your startup file (.bashrc) like this
source absolute_path/define-jip.bash 1
Here is "define-jip.bash"
-----------------------------------------------------------------------
#!/bin/bash
# Include any argument to suppress output. E.g.,
# source ~jbm/jip-current/define-jip.script 1
# from startup file .bashrc
# Set the JIP_HOME environment variable to access documentation from programs.
# e.g., xd -H
export JIP_HOME=/Users/jbm/Unix/jip-new
# These aliases point to scripts that pick the correct executables.
alias jip="$JIP_HOME/bin/jip"
alias xd="$JIP_HOME/bin/display"
alias align="$JIP_HOME/bin/align"
alias glm="$JIP_HOME/bin/glm"
alias rem="$JIP_HOME/bin/rem"
# Using any argument to this script will suppress output.
if [ $# -eq 0 ]
then
echo "Defined JIP_HOME to be $JIP_HOME"
echo "Defined these aliases: jip, xd, align, glm, rem"
fi
To use this script successfully, one must be working in the tcsh shell.
If you are not using this shell, you have two options:
1) Switch to tcsh like this ("%" represents the Unix/Linux prompt):
% tcsh
% define-jip.tcsh
... or put these definitions into your .cshrc startup file. Use any argument to suppress output:
source absolute_path/define-jip.tcsh 1
2) Modify the script for your particular Unix/Linux shell. For example, a bash script is shown
below. You must SOURCE this script, like this:
source define-jip.bash
but NOT like this:
./define-jip.bash
The latter method only creates temporary definitions in the scripting shell, not the working shell.
As with define-jip.tcsh, you can put this into your startup file (.bashrc) like this
source absolute_path/define-jip.bash 1
Here is "define-jip.bash"
-----------------------------------------------------------------------
#!/bin/bash
# Include any argument to suppress output. E.g.,
# source ~jbm/jip-current/define-jip.script 1
# from startup file .bashrc
# Set the JIP_HOME environment variable to access documentation from programs.
# e.g., xd -H
export JIP_HOME=/Users/jbm/Unix/jip-new
# These aliases point to scripts that pick the correct executables.
alias jip="$JIP_HOME/bin/jip"
alias xd="$JIP_HOME/bin/display"
alias align="$JIP_HOME/bin/align"
alias glm="$JIP_HOME/bin/glm"
alias rem="$JIP_HOME/bin/rem"
# Using any argument to this script will suppress output.
if [ $# -eq 0 ]
then
echo "Defined JIP_HOME to be $JIP_HOME"
echo "Defined these aliases: jip, xd, align, glm, rem"
fi
Threaded View
Title | Author | Date |
---|---|---|
Joseph Mandeville | Jan 19, 2011 | |
Joseph Mandeville | Jan 24, 2011 | |