Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1
/usr/X11R6/bin:/sbin:/home/matthew/bin

As you can see, the user (matthew in this example) can use the new bin
directory to hold executable files. Another way to bring up an environment
variable is to use the echo command along with the variable name (in this
case, $PATH):


Click here to view code image
matthew@seymour:~$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/bball/bin


CAUTION
Never put . in your $PATH to execute files or a command in the current
directory; doing so presents a serious security risk, especially for the root
operator, and even more so if . is first in your $PATH search order. Trojan
scripts placed by crackers in directories such as /tmp can be used for
malicious purposes and will be executed immediately if the current working
directory is part of your $PATH.

Storing Shell Scripts for System-wide Access


After you execute the command myenv, you should be able to use ldir
from the command line to get a list of files under the current directory and ll
to get a list of files with attributes displayed. However, the best way to use the
new commands in myenv is to put them into your shell’s login or profile file.
For Ubuntu users, and nearly all Linux users, the default shell is bash, so
you can make these commands available for everyone on your system by
putting them in the /etc/bashrc file. System-wide aliases for tcsh are
contained in files with the extension .csh under the /etc/profile.d
directory. The pdksh shell can use these command aliases, as well.


NOTE
To use a shell other than bash after logging in, use the chsh command
from the command line or the system-config-users client during an
X session. You’ll be asked for your password (or the root password, if using
system-config-users) and the location and name of the new shell.
The new shell will become your default shell, but only if its name is in the
list of acceptable system shells in /etc/shells.

Interpreting Shell Scripts Through Specific Shells

Free download pdf