z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Editing commands from the history file

z/OS UNIX System Services User's Guide
SA23-2279-00

Suppose that you have a sequence of source files named file1.c, file2.c, file3.c, and so on that you want to compile with similar c89 commands. This situation is a little different from the one discussed in the previous topic. You do not want to rerun the same command for each file; the command has the same form each time, but you have to specify in a new file name each time.

You can still do this using the history file. The command:
^old_string^new_string
runs a previous command but replaces the first occurrence of the old string with the new string. For example, suppose you compile file1.c with:
c89 options file1.c
Then the command:
^file1^file2
tells the shell to look at the previous command and change file1 to file2. The shell makes this change, and then displays and runs the modified command.
^file2^file3
performs the same kind of operation, changing file2 in the previous command to file3 and then going ahead with the compilation. This saves you the trouble of retyping all the options for the command.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014