Bash script too many arg's


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash script too many arg's
# 8  
Old 10-15-2014
Quote:
Originally Posted by jcalisi
you guys are great. Corona your modification has it working now. Just so I can learn something what are the extra brackets and equals doing?
Single [ ] are an old-fashioned syntax which is kept for compatibility. [[ ]] does all the same things and more. == is an extended syntax which allows glob-matching like you do.
This User Gave Thanks to Corona688 For This Post:
# 9  
Old 10-15-2014
Actualy, with the use of *02.dat one could drop the check for its existence, as it should only be listed because it exists.
Thus it could be like:
Code:
for f in *02.dat;do mv "$f" "$CD/somefolder/"|| echo "Move failed with code: $?";done

hth
This User Gave Thanks to sea For This Post:
# 10  
Old 10-15-2014
thanks everyone. I'll check out the two links. I try to learn when I can and hope to help where I can. As always extremely helpful site.
# 11  
Old 10-15-2014
Quote:
Originally Posted by sea
Actualy, with the use of *02.dat one could drop the check for its existence, as it should only be listed because it exists.
Thus it could be like:
Code:
for f in *02.dat;do mv "$f" "$CD/somefolder/"|| echo "Move failed with code: $?";done

hth
In that case, the or `||' is not necessary since `mv' is going to show in stderr the failure.
Also, there's the possibility that *02.dat does not give any proper result to the for loop.

Last edited by Aia; 10-15-2014 at 04:13 PM..
This User Gave Thanks to Aia For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ? --- Post updated at 08:39 AM --- in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies

2. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

3. Shell Programming and Scripting

ksh script throwing arg list too long for mv cp wc - everything

i have a ksh script which internally calls another ksh script. this inner script has simple commands like shown in the code window. In the script im trying to do a mv - it fails with arg list too long. then i try to perform cp and cat - and both are failing with similar error. :wall: How is... (4 Replies)
Discussion started by: nyc68
4 Replies

4. Shell Programming and Scripting

script arg or parameters limitation

Hi, I would like to ask some info on the script arguments/parameters. Does script arguments had limitation like inside or deep inside the loop in which it will not function as it use to be. as an example: $2 not working command2 () { for log in $LOG{1,2,3} do if && ; then echo... (2 Replies)
Discussion started by: jao_madn
2 Replies

5. UNIX for Dummies Questions & Answers

Space in a arg

Hi, When i am running a script it considers the below as mulitple arguments. There is any command which can ignore the spaces. I tried by using sed like below to ignore but it doesnt work. sed 's/ /\\ /g'100% Haddock Fillets Battered 500G-small.gif ~vino (3 Replies)
Discussion started by: vino_hymi
3 Replies

6. Programming

warning: int format,pid_t arg (arg 2)

I try following code under Solaris10,like follows: int glob = 6; int main(void) { int var; pid_t pid; var = 88; printf("before vfork\n"); if ((pid = vfork()) < 0) { err_sys("vfork error"); } else if (pid == 0) { glob++; var++; _exit(0); } ... (1 Reply)
Discussion started by: konvalo
1 Replies

7. Shell Programming and Scripting

How to pass an array as arg to a script..

Hi, Please guide to pass an array as a arg to a script... for example, I have a script small.sh to find the small no of given arg as below... #! /bin/sh # this script is for finding the small number set -A arr_no_updates small=$1 i=1 for arr in $@ do if (3 Replies)
Discussion started by: little_wonder
3 Replies

8. Shell Programming and Scripting

how to make your bash script run on a machine with csh and bash

hi, i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there... (3 Replies)
Discussion started by: npatwardhan
3 Replies

9. Shell Programming and Scripting

passing variable from bash to perl from bash script

Hi All, I need to pass a variable to perl script from bash script, where in perl i am using if condition. Here is the cmd what i am using in perl FROM_DATE="06/05/2008" TO_DATE="07/05/2008" "perl -ne ' print if ( $_ >="$FROM_DATE" && $_ <= "$TO_DATE" ) ' filename" filename has... (10 Replies)
Discussion started by: arsidh
10 Replies
Login or Register to Ask a Question