10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I'm taking a unix class and need to countdown to 0 from whatever number the user inputs. I know how to do this with a while or until loop but using the for loop is throwing me off....
I know I can use an if-then statement in my for loop but can I include a while loop in my for loop? (3 Replies)
Discussion started by: xxhieixx
3 Replies
2. AIX
Hi,
I am having a file like,
#cat file
Jun 19 13:08
Jun 19 13:08
Jun 19 13:08
Jun 19 13:14
when I run the below comamnd locally it will work fine,
IFS=$'\n'; for i in $(cat file) ;do echo "HI $i" ; done
And the output is,
HI Jun 19 13:08
HI Jun 19 13:08
HI Jun 19 13:08
HI... (1 Reply)
Discussion started by: sumanthupar
1 Replies
3. Shell Programming and Scripting
Hi ,
I am trying to read a list of hosts from a config file and trying to get file list from that host. For this I have used one while loop.
cat "$ARCHIVE_CFG_FILE" | sed '/^$/d' | sed '/^#/d' | while read ARCHIVE_CFG
do
SOURCE_SERVER_NAME=`echo "$ARCHIVE_CFG" | awk -F '|' '{ print... (2 Replies)
Discussion started by: Anupam_Halder
2 Replies
4. Shell Programming and Scripting
Hi All,
Below is the very simple code snippet but it si giving me syntax error
#!/bin/bash
#To ensure If JMS directory exists or not
ServerName=$(hostname)
#To ensure If JMS directory exists or not
echo $ServerName
if ;
then
echo "Inside First If"
if ;
then
echo 'JMS... (4 Replies)
Discussion started by: sharsour
4 Replies
5. Shell Programming and Scripting
Hello all,
I would like to declare and use variables inside an ssh session. I have the feeling that it's not possible. Here is the situtation simpified:
#:/bin/sh
test="salut"
echo $test
ssh hudson@10.41.21.99 <<EOF
export testssh="salut"
echo testssh=$testssh
... (4 Replies)
Discussion started by: Lotfus
4 Replies
6. 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
7. Shell Programming and Scripting
Hi,
I am using su within a for loop. As you might expect, it prompts for password during each loop execution. Here is my piece of code:
for i in $LIST
do
if
then
DATABASE=`echo $i | awk -F "|" '{ print $1 }'`
USER_ID=`echo $i | awk -F "|" '{ print $2 }'`
su - apstage -c... (1 Reply)
Discussion started by: sugan
1 Replies
8. 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
9. Shell Programming and Scripting
Hi Gurus
I have a file called /tmp/CMDB which looks like this
serial: 0623AN1208
hostname: server1
model: x4100
assetID: 1234
I am writing a for loop that will go through this file line by line creating a variable of itself. Using the first iteration of the loop (i.e. the first line) as... (6 Replies)
Discussion started by: hcclnoodles
6 Replies
10. Shell Programming and Scripting
set -A arr a1 a2 a3 a4
# START
ssh -xq $Server1 -l $Username /usr/bin/ksh <<-EOS
integer j=0
for loop in ${arr}
do
printf "array - ${arr}\n"
(( j = j + 1 ))
j=`expr j+1`
done
EOS
# END
=========
this is not giving me correct output.
I... (5 Replies)
Discussion started by: reldb
5 Replies