Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data: This is what is asked:
If the user enters ‘3’, prompt the user for two file names. Verify that the file names given already exist and are regular files. If not, display an error message. If both file names exist and are regular files, display a message showing which of the two files is older. If they’re the same, display either one (your choice).
I got my script below. I'm just wondering why is it after prompting the user, my next line of script which is the if-else part is not working.
2. Relevant commands, code, scripts, algorithms:
3. The attempts at a solution (include all code and scripts):
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Northern Alberta Institute of technology, AB, CA, Dan G., Dmit1532
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Moderator's Comments:
Please use CODE tags as required by forum rules.
Without CODE tags, all internal sequences of blank characters (i.e., <space>s and <tab>s) are converted to a single <space> and leading and trailing blanks are completely removed.
Last edited by Don Cragun; 02-26-2018 at 03:52 AM..
Reason: Add CODE tags.
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data: This is what is asked:
If the user enters ‘3', prompt the user for two file names. Verify that the file names given already exist and are regular files. If not, display an error message. If both file names exist and are regular files, display a message showing which of the two files is older. If they're the same, display either one (your choice).
I got my script below. I'm just wondering why is it after prompting the user, my next line of script which is the if-else part is not working.
2. Relevant commands, code, scripts, algorithms:
3. The attempts at a solution (include all code and scripts):
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Northern Alberta Institute of technology, AB, CA, Dan G., Dmit1532
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Moderator's Comments:
Please use CODE tags as required by forum rules.
Without CODE tags, all internal sequences of blank characters (i.e., <space>s and <tab>s) are converted to a single <space> and leading and trailing blanks are completely removed.
How do you know it isn't working? Immediately after one of the echo commands completes, you start the next iteration of your loop. And, the first thing you do in each iteration of your loop is clear the screen.
This User Gave Thanks to Don Cragun For This Post:
The script does work, but you've got the logics wrong. Check without clearing the screen between the loops. Mayhap after settimng the -vx shell options.
Foe example we have three environments int,qa and prod.Each environment has some number of servers.
int=Server1,Server2,Server3
qa=Server4,Server5,Server6
prod=Server7,Server8,Server9
echo "Enter the Environment i.e int,qa,prod"
read env
case $env in
int)
## Need command where all the... (9 Replies)
I am using a variable called $variable in a pattern search to print from a starting variable to a constant value. the variable search should be case in sensitive.
i tired using Ip at the end in the below command. but in ksh it is not working.
sed -n "/$variable/,/constant/p" file
i also... (11 Replies)
Hi,
I am having two set of files with different number of columns and rows.
A set of files have only single row with 20 columns.
B set of files have 1000s of rows with 5 columns.
both set contains equal number of files.
I want to save all the 20 columns of A in variables one by one and... (21 Replies)
Is there a command that can switch a character variable from UPPER case to lower case?
like
foreach AC ( ABC BCD PLL QIO)
set ac `COMMAND($AC)`
...
end
Thanks a lot! (3 Replies)
Hi,
I have general question: i have good working Perl script with .pl extension, and now I have to migrate all to another Linux box, and I was told that I can use only shell scripting, so I'm not sure how different those two things are, will it work without any changes . Is there anything smart I... (6 Replies)
In shell Can I pass " to a program ? If not what is the work around ..?
Can I define * as a wild card charecter that will return all the values from
the files ..?
I am trying to create a tool that will return the values from a property file . This tool has to support all the wild card... (1 Reply)
Hi All,
I am new to this forum also new to shell scripting.
I have a requirement to read a text from a file which can be in any case like LOGFILE or LogFile or logfile or lOgfILE etc..
Can you guys help me out.
Thanks,
Bacsi01 (1 Reply)
I want to learn Linux/Unix shell scripting, I searched this forum but got some results for Unix Admin books and general Linux books.
Would someone recommend a good Linux Shell Scripting book?
I did order one book
A Practical Guide to Linux(R) Commands, Editors, and Shell Programming ... (4 Replies)
Anyone here knows any reasonably priced courses for independent (not corporate) users that can point me to. Already know Unix commands/vi/etc but now need scripting too. Any replies will be appreciated. (2 Replies)