Question: Bold Text = missing part of the code for the scripts #!/ SYNTAX ######################################## # Class: ITEC400 # # Script name: # Functionality: # Author:
Bold Text = missing part of the code for the scripts
#!/SYNTAX
########################################
# Class: ITEC400
#
# Script name:
# Functionality:
# Author:
# Case #1:
# Script name: intlist.pl
#######################################
# Check for the correct number of arguments on the command line.
unless (SYNTAX(@SYNTAX)==2){
print "error: incorrect number of arguments",
" ",
"usage: intlist.pl a b (where a < b)",
" ";
exit VALUE;
}
# Check that first argument is smaller than second
if ($SYNTAX[INDEX] OPERATOR $SYNTAX[INDEX]){
print "error: first argument must be less than second argument",
" ",
"usage: intlist.pl a b (where a < b)",
" ";
exit VALUE;
}
# prints arguments
else {
$COUNTER=$SYNTAX[INDEX]; # Set COUNTER variable to low integer value
# Print integers until upper limit integer is reached
while($VARIABLE<=$ARGV[INDEX]){
print $VARIABLE;
if ($COUNTERRELATIONAL OPERATOR$ARGV[INDEX]){
print ", ";
}
else {
print " ";
}
$COUNTERSYNTAX
}
}
COMMAND VALUE;
#!/usr/bin/PROGRAM STATEMENT
########################################
#
# Author:
# Script name: linenum.pl
# Functionality:
# Input format: linenum.pl :
# Case #1:
#
#######################################
# Check for the correct number of arguments
unless (SYNTAX){
print "error: incorrect number of arguments",
" ",
"usage: linenum.pl [filename]",
" ";
exit VALUE;
}
# Open function used with filehandle and input file.
COMMAND(MY_FILE, "$ARGV[INDEX]") or die
"error: argument must be a file ",
"usage: linenum.pl [filename] $! ";
# Check if file is a directory
if (-SYNTAX "$SYNTAX[INDEX]"){
print "error: argument must be a file",
" ",
"usage: linenum.pl [filename] ";
exit VALUE;
}
$COUNTER=1; # Used for printing line numbers
# Loop and write lines from file
SYNTAX ($LINEEQUALITY OPERATOR
# Adds leading zeros for numbers 1 digit long
if ($COUNTER<10){
print "000";
}
# Adds leading zeros for numbers 2 digits long
if (($COUNTER>9) && ($COUNTER<100)){
print "00";
}
# Adds leading zeros for numbers 3 digits long
if (($COUNTER>99) && ($COUNTER<1000)){
print "0";
}
# Prints line number and line
print "$COUNTER: $LINE";
$COUNTER+=1;
}
exit VALUE;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
