It is currently Thu, 20 Sep 2018 02:56:16 GMT



 
Author Message
 chmod in a ksh script
I am having problems with a Korn Shell script I am writting.  The
script ftp's files from another server and must chmod the files
for global read access.

chmod 644 $TARGET_DIR/*

produces the following output:

chmod: can't access /bnr/users/u1/trice/tmp/*

before you ask, yes everything in the path has 700 permission.

Forgive me if this is a faq.

=======================================================================
Tony R. Rice                                     Bell Northern Research
Systems Development Environment Support      Research Triangle Park, NC
-----------------------------------------------------------------------
tr...@bnr.ca          "    GO     "        Opinions are my own, & don't
mrm...@aol.com           HOKIES!             reflect those of BNR or NT
=======================================================================



 Sun, 02 Jul 1995 03:21:08 GMT   
 chmod in a ksh script
In article <1993Jan12.192108.14...@brtph560.bnr.ca>, trice@brtph330
|>I am having problems with a Korn Shell script I am writting.  The
|>script ftp's files from another server and must chmod the files
|>for global read access.
|>
|>chmod 644 $TARGET_DIR/*
|>
|>
|>produces the following output:
|>
|>chmod: can't access /bnr/users/u1/trice/tmp/*
|>
|>
|>before you ask, yes everything in the path has 700 permission.
|>
|>
|>Forgive me if this is a faq.
|>
|>=======================================================================
|>Tony R. Rice

Sounds like you have the '-f' flag set, in which case it is
trying to (literally) chmod the file '/bnr/users/u1/trice/tmp/*' which
(probably)
does not exist.

Try doing a 'set +f' before the chmod statement, this turns on wildcarding.

Doug

------------------------------------------------------------------------
---------
Douglas G. Stetner, 4Y22  |  Bell-Northern Research  | ESN 6+39+3+8396
      stet...@bnr.ca      |  P.O. Box 3511, Stn. C   | (613) 763-8396  (work)
 My opinions are my own.  |  Ottawa, ON, CANADA      | (613) 828-6321  (home)



 Sun, 02 Jul 1995 04:30:50 GMT   
 chmod in a ksh script

Tony> I am having problems with a Korn Shell script I am writting.  The
Tony> script ftp's files from another server and must chmod the files
Tony> for global read access.

Tony> chmod 644 $TARGET_DIR/*

Tony> produces the following output:

Tony> chmod: can't access /bnr/users/u1/trice/tmp/*

I agree with Doug Stetner's "set +f" answer, but would like to point
out another possible problem. If "*" expands to a whole lot of files,
your script will die because the command line's too long. I suggest
you use find and xargs, thusly:

find $TARGET_DIR -type f -print | xargs chmod 644

Walt

--
Walt Sullivan
INTERNET: w...@bnr.ca (work)
UUCP: w...@orbit.ocunix.on.ca (home)
FIDO: 1:163/109.4



 Mon, 03 Jul 1995 22:47:44 GMT   
 chmod in a ksh script
: I agree with Doug Stetner's "set +f" answer, but would like to point
: out another possible problem. If "*" expands to a whole lot of files,
: your script will die because the command line's too long. I suggest
: you use find and xargs, thusly:
:
: find $TARGET_DIR -type f -print | xargs chmod 644
:

Thanks guys, worked like a charm

--
=======================================================================
Tony R. Rice                                     Bell Northern Research
Systems Development Environment Support      Research Triangle Park, NC
-----------------------------------------------------------------------
tr...@bnr.ca          "    GO     "        Opinions are my own, & don't
mrm...@aol.com           HOKIES!             reflect those of BNR or NT
=======================================================================



 Tue, 04 Jul 1995 00:09:33 GMT   
 
   [ 4 post ] 

Similar Threads

1. ksh script problem: pwd works differently for ksh then linux binary file

2. script or command to find all scripts (ksh, sh, perl, etc) in a workspace

3. ksh script --> sh script problems

4. AIX 432 - ksh -x option when script calls another script


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software