From: moonhkt on 7 May 2010 01:00 Hi All I create *.zip or *.tar on Machine A by my id for *.p, *.i , *.ksh, * . Then Migration Team using their ID, using ftp to get the zip or tar file. The scripe file mode in Machine A is -rwxr-xr-x , when tar -xvf or pkzinzip, in Machine B changed to -rw-r--r-- In Machine B, the umask is 012. How to keep the file modes same as original ? For *p, *.i or other file , file mode is 744 Now, Using below script to change *.ksh *.sh and * to 755 while read -r ifn do FFN=$(basename $ifn) FDIR=$(dirname $ifn) .... # chmod echo "" | awk -v FFN=$FFN -v FN=$ifn '{ if ( FFN ~ /\.ksh$|\.sh$/ || index (FFN,".") == 0 ) { cmd = "chmod 755 " FN system(cmd) } } ' .... moonhkt
From: Michael Paoli on 12 May 2010 02:02 On May 6, 10:00 pm, moonhkt <moonhkt(a)gmail.com> wrote: > I create *.zip or *.tar on Machine A by my id for *.p, *.i , *.ksh, > * . Then Migration Team using their ID, using ftp to get the zip or > tar file. > > The scripe file mode in Machine A is -rwxr-xr-x , > when tar -xvf or pkzinzip, in Machine B changed to -rw-r--r-- > > In Machine B, the umask is 012. How to keep the file modes same as > original ? > > For *p, *.i or other file , file mode is 744 > > Now, Using below script to change *.ksh *.sh and * to 755 > > while read -r ifn > do > FFN=$(basename $ifn) > FDIR=$(dirname $ifn) > > ... > # chmod > echo "" | awk -v FFN=$FFN -v FN=$ifn '{ > if ( FFN ~ /\.ksh$|\.sh$/ || index (FFN,".") == 0 ) { > cmd = "chmod 755 " FN > system(cmd) > } > } ' > > ... Some hints: $ >f && chmod 754 f && ls -ln f -rwxr-xr-- 1 1003 100 0 May 11 22:58 f $ tar -cf tar f $ rm f $ tar -xpf tar f && ls -ln f && rm -f f -rwxr-xr-- 1 1003 100 0 May 11 22:58 f $ (umask 077 && tar -xf tar f && ls -ln f && rm -f f) -rwx------ 1 1003 100 0 May 11 22:58 f $ (umask 077 && tar -xpf tar f && ls -ln f && rm -f f) -rwxr-xr-- 1 1003 100 0 May 11 22:58 f $ (umask 0 && tar -xf tar f && ls -ln f && rm -f f) -rwxr-xr-- 1 1003 100 0 May 11 22:58 f $
|
Pages: 1 Prev: Case insensitive searching in gvim Next: Is it because of race condition? |