Editing and executing command lines, Replacing and reexecuting command lines, The shell environment – HP NonStop G-Series User Manual

Page 43

Advertising
background image

16 pwd

17 cd /u/ben/reports

18 more sales

Editing and Executing Command Lines

To display and edit command lines 15 through 18 with the vi editor, enter:

$ fc -e vi 15 18

ls -la

pwd

cd /u/ben/reports

more sales

~

~

~

~

"/tmp/sh10268.3" 4 lines 40 characters

After making your edits, write and exit the file with the vi :wq! command. The command lines
in the file are then reexecuted.

Replacing and Reexecuting Command Lines

Assume that you have just entered the echo hello command, and now you wish to replace
hello

with goodbye. To do the replacement and reexecute the command line, enter:

$ echo hello

hello

$ fc -e - hello=goodbye echo

echo goodbye

goodbye

The Shell Environment

Each time you run osh, your OSS shell creates and maintains a working environment for you.
Your environment defines such characteristics as your user identity, where you are working on the
system, and what commands you are running.

Your working environment is created by variables defined in two files:

defines environment variables

/etc/profile

defines local shell variables

.profile

The /etc/profile file contains information that creates a default environment for all users. It is
maintained by the system administrator. When you run osh, the information in /etc/profile
is executed first, before the information in the .profile file. These variables are often called
“environment variables.”

The Shell Environment

43

Advertising
This manual is related to the following products: