O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

22.3. Amending records

We have already seen most of the code for amending a record. We saw this code when we looked at record deletion.

When the correct record has been found, we simply assign all the record field variables to a temp variable then, using the default assignment variable:

: {default_variable:=variable} 

The user can simply hit return on the fields he or she does not want to change. The default value will then replace the temp variable. Any amendments can be made simply by typing the new values in the adjacent fields.

						echo -n -e "EMPLOYEE NO: $CODE\n" 

echo -n "FIRST NAME : [$F_NAME] >" 
read _F_NAME 
: ${_FNAME:=$F_NAME} 
...
					

The actual updating of the file is carried out using grep with the -v option again. All records apart from ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required