diff options
author | Jim Meyering <jim@meyering.net> | 2000-11-06 08:46:01 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-11-06 08:46:01 +0000 |
commit | f472159d99a50062a1e24fb54512bc8a9277f295 (patch) | |
tree | d83ffaeddfa2ebaba4dd1a136be30bb5b46339a5 /tests | |
parent | 0e1b0b2ea20e601f24cd51bb4e9199ca1ae01a7c (diff) | |
download | coreutils-f472159d99a50062a1e24fb54512bc8a9277f295.tar.xz |
*** empty log message ***
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/rwx-to-mode | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/rwx-to-mode b/tests/rwx-to-mode new file mode 100755 index 000000000..52bb5d155 --- /dev/null +++ b/tests/rwx-to-mode @@ -0,0 +1,12 @@ +#!/bin/sh +# Convert an ls-style permission string, like drwxr----x and -rw-r-x-wx +# to the equivalent chmod --mode (-m) argument, (=,u=rwx,g=r,o=x and +# =,u=rw,g=rx,o=wx). + +# FIXME: handle special bits, too. + +rwx=$1 +u=`echo $rwx|sed 's/^.\(...\).*/\1/;s/-//g'` +g=`echo $rwx|sed 's/^....\(...\).*/\1/;s/-//g'` +o=`echo $rwx|sed 's/^.......\(...\).*/\1/;s/-//g'` +echo "=,u=$u,g=$g,o=$o" |