projects
/
platform
/
upstream
/
coreutils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0e1b0b2
)
*** empty log message ***
author
Jim Meyering
<jim@meyering.net>
Mon, 6 Nov 2000 08:46:01 +0000
(08:46 +0000)
committer
Jim Meyering
<jim@meyering.net>
Mon, 6 Nov 2000 08:46:01 +0000
(08:46 +0000)
tests/rwx-to-mode
[new file with mode: 0755]
patch
|
blob
diff --git a/tests/rwx-to-mode
b/tests/rwx-to-mode
new file mode 100755
(executable)
index 0000000..
52bb5d1
--- /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"