Visit Our UNIX and Linux User Community


Execute command inside while problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Execute command inside while problem
# 1  
Old 03-11-2009
Execute command inside while problem

Hi!

How can I execute a linux command inside the while cicle??

like:
Quote:
while [svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE] ; do
...
...
done
This doesn't work. Should I replace the [] by '' or ""
# 2  
Old 03-11-2009
There must be a space after the open square bracket '[' and a space before the close square bracket ']'

Code:
while [ svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE ] ; do

instead of:

Code:
while [svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE] ; do

Regards
# 3  
Old 03-11-2009
Quote:
Originally Posted by ruben.rodrigues
Hi!

How can I execute a linux command inside the while cicle??

like:
Code:
while [svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE] ; do
...
...
done

This doesn't work. Should I replace the [] by '' or ""

Code:
while svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE ; do
...
...
done

# 4  
Old 03-11-2009
Quote:
Originally Posted by Franklin52
There must be a space after the open square bracket '[' and a space before the close square bracket ']'

Code:
while [ svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE ] ;
do

instead of:

That doesn't execute svn; test (a.k.a. [) sees it as its first argument, and expects the second argument to be an operator.

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

2. Shell Programming and Scripting

Execute Alias inside script

Hi, in the .profile i have alias jh="cd /var/jdk"What should i write in my unix shell script to use jh and move to /var/jdk directory ? I tried the following in myscript.sh jh $jh $(jh)but none works !! (2 Replies)
Discussion started by: mohtashims
2 Replies

3. Shell Programming and Scripting

How to execute a command inside a while loop?

How do we execute a command inside a while loop? (7 Replies)
Discussion started by: Little
7 Replies

4. Shell Programming and Scripting

Multiple command execution inside awk command during xml parsing

below is the output xml string from some other command and i will be parsing it using awk cat /tmp/alerts.xml <Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies

5. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

6. Shell Programming and Scripting

how do i execute nohup and background job inside the korn script for db2

load_cursor_stmt() { ls /db/admin/ddl/rmn01000/load_cursor*.sql|while read file do echo "${file}" `nohup db2 -tvf "$file" \&` done }Error: ------- /admin/ddl/rmn01000/load_cursor5.sql /db/admin/ddl/rmn01000/load_cursor6.sql + read file + echo... (3 Replies)
Discussion started by: Hangman2
3 Replies

7. UNIX for Dummies Questions & Answers

how to use expect - send to execute list of commands inside a file

:)hello people i am working on some kind of PBX and i have list of telephone numbers inside a file, i have to insert these numbers into the correct command and then telnet to a remote server and execute these commands. i can read the telephone numbers and insert them into the command with no... (0 Replies)
Discussion started by: auma78
0 Replies

8. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

9. UNIX for Dummies Questions & Answers

Problem with executing command inside a cron job

Hi All, I have scheduled a script in cron which writes output to the below file. ....>> /data/Target/wrapper_invoke_ds_job_`date '+%Y%m%d'`.ksh_out 2>&1 But the date command is not getting resolved in the format specified. It just resolves to the following. wrapper_invoke_MQ_ds_job_Tue... (3 Replies)
Discussion started by: pkm_oec
3 Replies

10. UNIX for Dummies Questions & Answers

Plz Help : How to use write command to execute command on some other terminal

Hi Group , I m trying to execute commands on some other system using write command but inspite of executing the commands they r passed as simple messages. - i m writing >write user-id ! ls o ctrl-d inspite of executing the command ls,other terminal shows ! ls. Thnx in advance. (2 Replies)
Discussion started by: Aashish
2 Replies

Featured Tech Videos