04-03-2008
Running a String as a command, zsh.
I have a shell script that is building a string that consists of the parts of a command that I want run at the end of the string. So it looks like this:
$PART1=/path/to/command
$PART2="-arg1"
$PART3="-arg2"
and so on.
At the end of the command is a list of files I get from a loop and place in its own string.
So in the end I end up with:
$PART1 $PART2 $PART3 $FILES
as the command I want to run.
The problem is that when the script is run the command ends up being:
/path/to/command -arg1 -arg2 '/path/to/file1 /path/to/file2'
if there are any spaces in the file names which there often are.
How can I get rid of the single quotes and just have the command be:
/path/to/command -arg1 -arg2 /path/to/file1 /path/to/file2
I am doing this as zsh script on OS X.
Thanks.
10 More Discussions You Might Find Interesting
1. SuSE
Sir,
I using the following commands in a file (part of a bigger script):
#!/bin/bash
cd /opt/oracle/bin
ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out
If I run this from the command prompt the result is:
2007-05-16
if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies
2. Shell Programming and Scripting
ptree command is not working in zsh. Could anyone let me know the equivalent of ptree command in zsh. (3 Replies)
Discussion started by: dhams
3 Replies
3. Shell Programming and Scripting
Hi all
is there a way to run zsh commands in a tcsh shell
thanks (3 Replies)
Discussion started by: ab52
3 Replies
4. UNIX for Dummies Questions & Answers
I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing
set
you can also use them "on the command line when running a script..." and it lists this in a small table:
set -o option Command Line... (5 Replies)
Discussion started by: Straitsfan
5 Replies
5. Shell Programming and Scripting
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
6. Shell Programming and Scripting
Hi,
Is there any specific command to use to check only say Running jobs via autorep or similar command for Autosys? (0 Replies)
Discussion started by: sidnow
0 Replies
7. Shell Programming and Scripting
Hi,
I would like to run following code in bash inside a zsh script. (In this case is output unfortunately very different if you run it in zsh).
I tried to put "bash" in front of the code but I obtained following error message "bash: do: No such file or directory
" eve though I merged the whole... (7 Replies)
Discussion started by: kamcamonty
7 Replies
8. AIX
exec(): 0509-036 Cannot load program /usr/opt/freeware/bin/rpm because of the following errors:
0509-022 Cannot load module /opt/freeware/lib/libintl.a(libintl.so.1).
0509-150 Dependent module /opt/freeware/lib/libiconv.a(shr4.o) could not be loaded.
0509-152 Member... (4 Replies)
Discussion started by: Ohmkar
4 Replies
9. Shell Programming and Scripting
Note: This posting is related to my posting at bash - Reading answer to control string sent to xterm - Stack Overflow , but I could get there a solution only for bash. I can use that solution, but for curiosity, I wonder, whether I could do this in Zsh as well.
The problem is to send a (Posix-)... (6 Replies)
Discussion started by: rovf
6 Replies
10. UNIX for Beginners Questions & Answers
Hello Forum,
I'm making very good progress on my report thanks to the very helpful people on this forum. I've been able to successfully create my report for my Red Hat servers. But I do have a few ubuntu servers in the mix and I'd like to capture some data from them when an ssh connection is... (8 Replies)
Discussion started by: greavette
8 Replies