10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
have issue where my elsif is always failing. Basically i have a file with sets of 2 lines, the 1st line that containing "ipwr" and the 2nd line containing a value or "unknown". if the 2nd line contains a value then i want to print the pair of lines.
open (INFO, "temp.txt") or die;
... (3 Replies)
Discussion started by: johnny921
3 Replies
2. Shell Programming and Scripting
I have a file like
file.
file.TODAY.THISYEAR
file.TODAY.LASTYEARI want to substitute the words in caps with their actual values so that output should look like
file.140805
file.140805.2014
file.140805.2013For this I am reading the file line bye line in an array and using multiple map... (1 Reply)
Discussion started by: sam05121988
1 Replies
3. Shell Programming and Scripting
Hello. I am new here and new to scripting. I used to have a very basic script that worked for simple backup/restore of files. I have expanded it and well... I have ended up with a complete mess. It still backs up and restores but there is so many issues that stem from the many if statements I... (3 Replies)
Discussion started by: gameinn
3 Replies
4. Shell Programming and Scripting
Hi guys,
Two problems I need solving please. I created a script where the user types in 7 numbers as standard input and each one is then stored in an array. Now I need to perform the following calculations on those numbers:
1) Use a while loop to determine the largest number in the range.
... (2 Replies)
Discussion started by: jjb1989
2 Replies
5. Programming
So far, all I have been able to come up with is:
if ($check=~/no/ || $check=~/n/)
but the problem with this, is that it looks for any character and the if statement is true. So if I wanted to check for an argument "-help" or lets say a variable string that could be a file name. Then... (2 Replies)
Discussion started by: adelsin
2 Replies
6. UNIX for Dummies Questions & Answers
Hi, I am trying to write a for statement that will allow for the ps, who, finger, and date commands to run. Can anyone help? I use Putty. (22 Replies)
Discussion started by: lexydoll87
22 Replies
7. UNIX for Advanced & Expert Users
This is for a program I have to do to calculate the day of the week.
I need to write an if statement that will do the following:
if day is 29 and year is odd, don't calculate dayif ( day == 29 && year == ??? )I know how to do it for the day but I don't know how to do it for the year. (4 Replies)
Discussion started by: pwanda
4 Replies
8. Shell Programming and Scripting
Hi All,
Must be something obvious I am missing, but the simple script below doesn't work.
#!/bin/sh
x=4
if
then
echo "x is $x"
elsif
then
echo "x is greater than 4"
else
echo "x is less than 4"
fi
When I run this script, I get the error message:
7: Syntax error... (3 Replies)
Discussion started by: leostar_10
3 Replies
9. UNIX for Dummies Questions & Answers
Sorry to be a pain, but how does the else work in the if statements?
Ive been making scripts with if statements but i cant get the else statements working.
Can you help? (8 Replies)
Discussion started by: chapmana
8 Replies
10. Shell Programming and Scripting
Can someone explain the difference between backticks and system when
evaluated in these if statements:
sub getDate {
print "start date\n";
if ( system("/bin/date") ) {
print "can't get date\n";
exit(2);
}
print "finish date\n";
}
Returns the following:
start date
Thu... (5 Replies)
Discussion started by: gjkeenan
5 Replies