|
Home > Archive > Unix Shell > February 2005 > length of command in different shells
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
length of command in different shells
|
|
| Christian Caron 2005-02-24, 5:58 pm |
| Hi,
I have a PERL script telnetting from one server to another and issuing this
command:
/usr/bin/sh -c '/usr/bin/echo "AuthUserFile
/www7/mysitename.mysitename/wgroup/.htpasswd\nrequire user wgroup_members
\nAuthType Basic\nAuthName /www7/mysitename.mysitename/wgroup\n\norder
deny,allow\ndeny from all\n"' > /www7/mysitename.mysitename/wgroup/.htaccess
If the script is logging into the bash or tcsh shells, it does work. If it
is csh, ksh or sh, it gets truncated by 8 characters:
/usr/bin/sh -c '/usr/bin/echo "AuthUserFile
/www7/mysitename.mysitename/wgroup/.htpasswd\nrequire user wgroup_members
\nAuthType Basic\nAuthName /www7/mysitename.mysitename/wgroup\n\norder
deny,allow\ndeny from all\n"' > /www7/mysitename.mysitename/wgroup/.
and it doesn't work.
Any pointer as to why this is happening?
Thanks!
Christian
| |
| Martin Klar 2005-02-24, 5:58 pm |
| Christian Caron wrote:
>
> Hi,
>
> I have a PERL script telnetting from one server to another and issuing this
> command:
>
> /usr/bin/sh -c '/usr/bin/echo "AuthUserFile
> /www7/mysitename.mysitename/wgroup/.htpasswd\nrequire user wgroup_members
> \nAuthType Basic\nAuthName /www7/mysitename.mysitename/wgroup\n\norder
> deny,allow\ndeny from all\n"' > /www7/mysitename.mysitename/wgroup/.htaccess
>
> If the script is logging into the bash or tcsh shells, it does work. If it
> is csh, ksh or sh, it gets truncated by 8 characters:
>
> /usr/bin/sh -c '/usr/bin/echo "AuthUserFile
> /www7/mysitename.mysitename/wgroup/.htpasswd\nrequire user wgroup_members
> \nAuthType Basic\nAuthName /www7/mysitename.mysitename/wgroup\n\norder
> deny,allow\ndeny from all\n"' > /www7/mysitename.mysitename/wgroup/.
>
> and it doesn't work.
>
> Any pointer as to why this is happening?
>
> Thanks!
>
> Christian
maybe there is a command-line-length-limitation
(your commandline is longer than 255 chars)
take a look at
/usr/include/bits/posix1_lim.h:50:#define _POSIX_MAX_CANON 255
HTH Martin
--
Martin Klar
Forschungszentrum Karlsruhe, IMK
76344 Eggenstein-Leopoldshafen
Tel: 07247-82-6268, Fax: 07247-82-4742
| |
| Janis Papanagnou 2005-02-24, 5:58 pm |
| Christian Caron wrote:
> Hi,
>
> I have a PERL script telnetting from one server to another and issuing this
> command:
>
> /usr/bin/sh -c '/usr/bin/echo "AuthUserFile
> /www7/mysitename.mysitename/wgroup/.htpasswd\nrequire user wgroup_members
> \nAuthType Basic\nAuthName /www7/mysitename.mysitename/wgroup\n\norder
> deny,allow\ndeny from all\n"' > /www7/mysitename.mysitename/wgroup/.htaccess
>
> If the script is logging into the bash or tcsh shells, it does work. If it
> is csh, ksh or sh, it gets truncated by 8 characters:
>
> /usr/bin/sh -c '/usr/bin/echo "AuthUserFile
> /www7/mysitename.mysitename/wgroup/.htpasswd\nrequire user wgroup_members
> \nAuthType Basic\nAuthName /www7/mysitename.mysitename/wgroup\n\norder
> deny,allow\ndeny from all\n"' > /www7/mysitename.mysitename/wgroup/.
>
> and it doesn't work.
>
> Any pointer as to why this is happening?
Just two observations...
- The length of your command is 256 + 8 characters long.
- You have 8 escaped characters \n in your string.
Change these conditions one after the other and see how it affects
the output.
> Thanks!
>
> Christian
Janis
|
|
|
|
|