10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm a rookie who is trying to learn this stuff. What I need help with is putting together a non complicated "while" loop within the below "if" statement. I also need the while loop to keep looping until the user types a key to end the loop. Please reveal the proper insertion points. Thank... (4 Replies)
Discussion started by: jefferj54
4 Replies
2. Shell Programming and Scripting
I need to match multiple values in a single column in a file:
example:
Source file:
abd,123,one
def,232,two
ghi,987,six
Target file:
12345,abcde,123
09876,zxvyr,566
56789,lmnop,232
Variable:
var1=`grep 2 sourcefile | awk '{print$1}'
essentially, echo "$var1" would read:... (2 Replies)
Discussion started by: kopfgeldjagar
2 Replies
3. Shell Programming and Scripting
Hey guys,
a=`cat abc | wc -l`
b=`cat def | wc -l`
if $a== $b
then
echo "a"
else
echo "b"
fi
I want the if condition to retry itself , untill a==b.
I can't use goto statemt.
Please help.
Thanx in advance.
Please use next time code tags for your code and data (5 Replies)
Discussion started by: jaituteja
5 Replies
4. Shell Programming and Scripting
I am writing a bash script that asks the user for input and I need it to repeat until the user selects quit.. I dont know how to write the loop for it I searched all over but i still do not get it.. if anyone could help with this it would be greatly apprciated here is my script so far:
#!... (2 Replies)
Discussion started by: Emin_Em
2 Replies
5. Shell Programming and Scripting
Hi all
Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Discussion started by: rethink
4 Replies
6. Shell Programming and Scripting
Well, I think I've managed to take two different issues and conglomerate them into and embarrasing mess.
#!/bin/bash
# Set some variables
dir1=/path/that/isnt/variable/$variabledir/dir/
dir2=/path/that/isnt/variable/$variabledir/important/"$variabledir"-subdirectory/path/
echo "Gimme... (7 Replies)
Discussion started by: karlp
7 Replies
7. Shell Programming and Scripting
I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends.
As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Discussion started by: DeCoTwc
2 Replies
8. Shell Programming and Scripting
Hi,
I use AIX (ksh) and Linux (bash) servers. I'm trying to do scripts to will run in both ksh and bash, and most of the time it works. But this time I don't get it in bash (I'm more familar in ksh).
The goal of my script if to read a "config file" (like "ini" file), and make various report.... (2 Replies)
Discussion started by: estienne
2 Replies
9. UNIX for Dummies Questions & Answers
#!/usr/bin/ksh
echo Please enter
while read n
do
echo $n >> datafile
done
question:
How can I enject an if statement that if the users enter 0 (zero) the program will exit?
this is what I have but not working
#!/usr/bin/ksh
echo Please enter number
while read n
do
if $n=0
then... (2 Replies)
Discussion started by: bobo
2 Replies
10. UNIX for Dummies Questions & Answers
I am attempting to pass a string into awk and loop through it, and then for every occurrance of a certain character perform an action. In this case, for example, echo 1 for each time character r is found in the string. Except I can't get it to work. Could someone please tell me why?
echo... (7 Replies)
Discussion started by: Sniper Pixie
7 Replies