Sponsored Content
Top Forums Shell Programming and Scripting "Argument list too long" error Post 302449933 by mario8eren on Wednesday 1st of September 2010 03:23:00 AM
Old 09-01-2010
"Argument list too long" error

Hi everyone,

I have a problem with my shell script. As a quick overview I need to change a template file 6561 times and copy the file into a new catalogue. Thanks to your forum I have managed to write a script to do so:

Code:
#!/bin/sh

template=$1
for values in {45,165,285}\ {45,165,285}\ {45,165,285}\ {45,165,285}\ {45,165,285}\ {45,165,285}\ {45,165,285}\ {45,165,285}; do
    set $values
    A=$1; B=$2; C=$3; D=$4; E=$5; F=$6; G=$7; H=$8
    mkdir "A$A-B$B-C$C-D$D-E$E-F$F-G$G-H$H"
    cp en ./"A$A-B$B-C$C-D$D-E$E-F$F-G$G-H$H"
    cp nf ./"A$A-B$B-C$C-D$D-E$E-F$F-G$G-H$H"
    cp define.sh ./"A$A-B$B-C$C-D$D-E$E-F$F-G$G-H$H"
    cp cosmoprep.sh ./"A$A-B$B-C$C-D$D-E$E-F$F-G$G-H$H"
    sed "s/A\$/$A/;s/B\$/$B/;s/C\$/$C/;s/D\$/$D/;s/E\$/$E/;s/F\$/$F/;s/G\$/$G/;s/H\$/$H/" "template" > ./A$A-B$B-C$C-D$D-E$E-F$F-G$G-H$H/"A$A-B$B-C$C-D$D-E$E-F$F-G$G-H$H"
    cd ./A$A-B$B-C$C-D$D-E$E-F$F-G$G-H$H
    babel -igzmat "A$A-B$B-C$C-D$D-E$E-F$F-G$G-H$H" -oxyz coord.xyz
    source $USELIB/tm510
    x2t coord.xyz > coord
    sh define.sh
    sh cosmoprep.sh
    cd /yki/mount/glauber_home/mario8/Desktop/magister/arvutused/6/
done

Finishing this script takes a lot of time and it went well after I checked it after an hour, but at some point it starts to give errors:

Code:
def.sh: line 7: /bin/mkdir: Argument list too long
def.sh: line 8: /bin/cp: Argument list too long
def.sh: line 9: /bin/cp: Argument list too long
def.sh: line 10: /bin/cp: Argument list too long
def.sh: line 11: /bin/cp: Argument list too long
def.sh: line 12: ./A285-B285-C285-D285-E285-F285-G285-H285/A285-B285-C285-D285-E285-F285-G285-H285: No such file or directory
def.sh: line 13: cd: ./A285-B285-C285-D285-E285-F285-G285-H285: No such file or directory
def.sh: line 14: /usr/local/bin/babel: Argument list too long
/usr/yki/lib/use/tm510: line 30: /bin/hostname: Argument list too long
/usr/yki/science/turbomole-5.10/Config_turbo_env: line 19: /usr/yki/science/turbomole-5.10/scripts/sysname: Argument list too long
def.sh line 16: /usr/yki/science/turbomole-5.10/scripts/x2t: Argument list too long
def.sh: line 17: /bin/sh: Argument list too long
def.sh: line 18: /bin/sh: Argument list too long

I tried to name a folder with the maximum characters my script had and it worked. So I can't see the problem.

Please, help me.

Mario
 

10 More Discussions You Might Find Interesting

1. AIX

How to REMOVE USER that display error --> "Name is too long"

I wish to remove a user from the system... but an error occurr... I try to remove via SMITTY and try to remove via command line with rmuser -p (name of user) and does not works.... The system display that the "Name is too long" There another way to remove a user... or... (1 Reply)
Discussion started by: mgonzal
1 Replies

2. Shell Programming and Scripting

Argument list too long - Shell error

Trying to tar specific files from a directory causes problems when the number of files is too large. ls ~/logs | wc -l 5928 In the logs directory - I have 5928 files If I want to include all files with today's date - I run the following command tar cf ~/archive/LoadLogs_20060302.tar... (8 Replies)
Discussion started by: dad5119
8 Replies

3. Programming

error "Invalid argument" returned after call sched_setscheduler

the code is below and the was run on Solaris 9. ----------------------------- struct sched_param param; param.sched_priority = 99; if(sched_setscheduler(0, SCHED_RR, &param) == -1) { perror("setting priority"); exit(1); } ------------------------------- after the... (1 Reply)
Discussion started by: robin.zhu
1 Replies

4. UNIX for Dummies Questions & Answers

"test: argument expected" error

Hi, No need to say I'm new to unix shell scripting. I have a very simple script that goes this way: for datos in `ls -rt $UNXLOG/26-Jan*` do export arch=`echo $datos |cut -d, -f1` if then export linea1=`grep Debut ${arch}` export horatot=`echo $linea1 |cut -d' ' -f5` ... (7 Replies)
Discussion started by: mvalonso
7 Replies

5. Shell Programming and Scripting

Argument too long list error

I have a wrote a script which consits of the below line.. Below of this script I'm getting this error "ksh: /usr/bin/ls: arg list too long" The line is log_file_time=`ssh -i $HOME/.ssh/id_rsa -q $i ls -lrt /bp/karthik/test/data/log/$abc*|tail -1|awk '{print $8}'` And $abc alias is as "p |... (1 Reply)
Discussion started by: 22karthikreddy
1 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

Perl "Invalid argument error"

Hi , we have a issue in server, we are running a perl script to connect our clients, but we are not able to connect, every time we are getting the "Invalid argument error" Even i checked all the necessary perl modules are i installed in this server, #create the listen socket my... (2 Replies)
Discussion started by: anishkumarv
2 Replies

8. Shell Programming and Scripting

Read from "list1" and list matches in "list2"

I want to print any matching IP addresse in List1 with List 2; List 1 List of IP addresses; 161.85.58.210 250.57.15.129 217.23.162.249 74.76.129.101 30.221.177.237 3.147.200.59 170.58.142.64 127.65.109.33 150.167.242.146 223.3.20.186 25.181.180.99 2.55.199.32 (3 Replies)
Discussion started by: lewk
3 Replies

9. Shell Programming and Scripting

How to avoid "Too many arguments" error, when passing a long String literal as input to a command?

Hi, I am using awk here. Inside an awk script, I have a variable which contains a very long XML data in string format (500kb). I want to pass this data (as argument) to curl command using system function. But getting Too many arguments error due to length of string data(payloadBlock). I... (4 Replies)
Discussion started by: cool.aquarian
4 Replies

10. Shell Programming and Scripting

Copy of "How to create a long list of directories with mkdir?"

To bakunin and corona688: My result when text in file is ms_ww_546 ms_rrL_99999 ms_nnn_67_756675 is https://www.unix.com/C:\Users\Fejoz\Desktop\ttt.jpg I hope you can see the picture. There is like a "whitespace character" after 2 of the 3 created directories. ---------- Post... (0 Replies)
Discussion started by: setub
0 Replies
LR_ENVIRONMENT.IN(1)					  LogReport's Lire Documentation				      LR_ENVIRONMENT.IN(1)

NAME
lr_environment - Export Lire configuration in shell script form SYNOPSIS
eval `lr_environment` DESCRIPTION
The lr_environment command is used to import the Lire configuration in Lire shell scripts. All of Lire configuration variables will be written in a format that can be evaled by the shell. Shell scripts don't usually have to use that command, since it is done by the defaults file sourced by each command. The old names used by when the configuration was done in shell script are also exported by this script for backward compatibility. AUTHOR
Francis J. Lacoste <flacoste@logreport.org> VERSION
$Id: lr_environment.in,v 1.12 2006/07/23 13:16:33 vanbaal Exp $ COPYRIGHT
Copyright (C) 2003 Stichting LogReport Foundation LogReport@LogReport.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html. Lire 2.1.1 2006-07-23 LR_ENVIRONMENT.IN(1)
All times are GMT -4. The time now is 03:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy