Shell scripting: few example Bourne shell scripts executions
Not what you're looking for?
1. Will the following script execute without any error?
#!/bin/sh
if [ "$USER" ]
then
echo I am $USER
endif
echo Script completed.
2. Does the following script parse the password file and print it out by the user's "realname" "home directory" "login name"?
#!/bin/sh
OLDIFS=$IFS
IFS=:
cat /etc/passwd | while read f1 f2 f3 f4 f5 f6 f7
do
if [ "$f5" ]
then
IFS=,
set -- $f5
echo "$f1 $1 $f6"
IFS=:
fi
done
IFS=$OLDIFS.
Purchase this Solution
Solution Summary
Not only the solution tells what went wrong, but it also indicates what should have been the script code for the desired result.
Solution Preview
1. No. The sh interpreter does not find the end marker for the if block which results in an error. End ...
Purchase this Solution
Free BrainMass Quizzes
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.
Basic Networking Questions
This quiz consists of some basic networking questions.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.
C# variables and classes
This quiz contains questions about C# classes and variables.
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.