Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright 2013 Divya Kothari <divya.s.kothari@gmail.com> |
| 4 | # Copyright 2013 Robin Mittal <robinmittal.it@gmail.com> |
| 5 | |
| 6 | #testing "name" "command" "result" "infile" "stdin" |
| 7 | |
Rob Landley | d6f8c41 | 2014-07-04 21:21:45 -0500 | [diff] [blame] | 8 | PERM="---""--x""-w-""-wx""r--""r-x""rw-""rwx" |
| 9 | |
| 10 | num2perm() |
| 11 | { |
| 12 | for i in 0 1 2 |
| 13 | do |
| 14 | num=${1:$i:1} |
| 15 | printf "%s" ${PERM:$(($num*3)):3} |
| 16 | done |
| 17 | echo |
| 18 | } |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 19 | |
| 20 | # Creating test files to test chmod command |
| 21 | mkdir dir |
| 22 | touch file |
| 23 | |
Rob Landley | d6f8c41 | 2014-07-04 21:21:45 -0500 | [diff] [blame] | 24 | # We don't need to test all 511 permissions |
| 25 | for u in 0 1 2 3 4 5 6 7 |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 26 | do |
Rob Landley | d6f8c41 | 2014-07-04 21:21:45 -0500 | [diff] [blame] | 27 | for g in 0 3 6 |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 28 | do |
Rob Landley | d6f8c41 | 2014-07-04 21:21:45 -0500 | [diff] [blame] | 29 | for o in 0 7 |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 30 | do |
Rob Landley | d6f8c41 | 2014-07-04 21:21:45 -0500 | [diff] [blame] | 31 | if [ "$type" == file ] |
| 32 | then |
| 33 | type=dir |
| 34 | rm -rf "./$type" && mkdir $type |
| 35 | DASH=d |
| 36 | else |
| 37 | type=file |
| 38 | rm -f "./$type" && touch $type |
| 39 | DASH=- |
| 40 | fi |
| 41 | DASHES=$(num2perm $u$g$o) |
| 42 | testing "chmod $u$g$o $type" "chmod $u$g$o $type && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 43 | ls -ld $type | cut -d' ' -f 1 | cut -d. -f 1" "$DASH$DASHES\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 44 | done |
| 45 | done |
| 46 | done |
| 47 | |
| 48 | rm -rf dir file && mkdir dir && touch file |
| 49 | testing "chmod 750 dir 640 file" \ |
| 50 | "chmod 750 dir 640 file 2>/dev/null || |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 51 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-x---\n-rwxr-x---\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 52 | |
| 53 | rm -rf dir file && mkdir dir && touch file |
| 54 | testing "chmod 666 dir file" \ |
| 55 | "chmod 666 dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 56 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drw-rw-rw-\n-rw-rw-rw-\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 57 | |
| 58 | rm -rf dir file && mkdir dir && touch file |
| 59 | testing "chmod 765 *" "chmod 765 * && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 60 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxrw-r-x\n-rwxrw-r-x\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 61 | |
| 62 | ##### u,g,o,a=r,w,x |
| 63 | rm -rf dir file && mkdir dir && touch file |
| 64 | testing "chmod u=r dir file" "chmod u=r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 65 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "dr--r-xr-x\n-r--r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 66 | |
| 67 | rm -rf dir file && mkdir dir && touch file |
| 68 | testing "chmod u=w dir file" "chmod u=w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 69 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "d-w-r-xr-x\n--w-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 70 | |
| 71 | rm -rf dir file && mkdir dir && touch file |
| 72 | testing "chmod u=x dir file" "chmod u=x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 73 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "d--xr-xr-x\n---xr--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 74 | |
| 75 | rm -rf dir file && mkdir dir && touch file |
| 76 | testing "chmod u+r dir file" "chmod u+r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 77 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 78 | |
| 79 | rm -rf dir file && mkdir dir && touch file |
| 80 | testing "chmod u+w dir file" "chmod u+w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 81 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 82 | |
| 83 | rm -rf dir file && mkdir dir && touch file |
| 84 | testing "chmod u+x dir file" "chmod u+x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 85 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rwxr--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 86 | |
| 87 | rm -rf dir file && mkdir dir && touch file |
| 88 | testing "chmod u-r dir file" "chmod u-r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 89 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "d-wxr-xr-x\n--w-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 90 | |
| 91 | rm -rf dir file && mkdir dir && touch file |
| 92 | testing "chmod u-w dir file" "chmod u-w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 93 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "dr-xr-xr-x\n-r--r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 94 | |
| 95 | rm -rf dir file && mkdir dir && touch file |
| 96 | testing "chmod u-x dir file" "chmod u-x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 97 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drw-r-xr-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 98 | |
| 99 | rm -rf dir file && mkdir dir && touch file |
| 100 | testing "chmod g=r dir file" "chmod g=r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 101 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr--r-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 102 | |
| 103 | rm -rf dir file && mkdir dir && touch file |
| 104 | testing "chmod g=w dir file" "chmod g=w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 105 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwx-w-r-x\n-rw--w-r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 106 | |
| 107 | rm -rf dir file && mkdir dir && touch file |
| 108 | testing "chmod g=x dir file" "chmod g=x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 109 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwx--xr-x\n-rw---xr--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 110 | |
| 111 | rm -rf dir file && mkdir dir && touch file |
| 112 | testing "chmod g+r dir file" "chmod g+r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 113 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 114 | |
| 115 | rm -rf dir file && mkdir dir && touch file |
| 116 | testing "chmod g+w dir file" "chmod g+w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 117 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxrwxr-x\n-rw-rw-r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 118 | |
| 119 | rm -rf dir file && mkdir dir && touch file |
| 120 | testing "chmod g+x dir file" "chmod g+x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 121 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r-xr--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 122 | |
| 123 | rm -rf dir file && mkdir dir && touch file |
| 124 | testing "chmod g-r dir file" "chmod g-r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 125 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwx--xr-x\n-rw----r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 126 | |
| 127 | rm -rf dir file && mkdir dir && touch file |
| 128 | testing "chmod g-w dir file" "chmod g-w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 129 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 130 | |
| 131 | rm -rf dir file && mkdir dir && touch file |
| 132 | testing "chmod g-x dir file" "chmod g-x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 133 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr--r-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 134 | |
| 135 | rm -rf dir file && mkdir dir && touch file |
| 136 | testing "chmod o=r dir file" "chmod o=r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 137 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr--\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 138 | |
| 139 | rm -rf dir file && mkdir dir && touch file |
| 140 | testing "chmod o=w dir file" "chmod o=w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 141 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-x-w-\n-rw-r---w-\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 142 | |
| 143 | rm -rf dir file && mkdir dir && touch file |
| 144 | testing "chmod o=x dir file" "chmod o=x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 145 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-x--x\n-rw-r----x\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 146 | |
| 147 | rm -rf dir file && mkdir dir && touch file |
| 148 | testing "chmod o+r dir file" "chmod o+r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 149 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 150 | |
| 151 | rm -rf dir file && mkdir dir && touch file |
| 152 | testing "chmod o+w dir file" "chmod o+w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 153 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xrwx\n-rw-r--rw-\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 154 | |
| 155 | rm -rf dir file && mkdir dir && touch file |
| 156 | testing "chmod o+x dir file" "chmod o+x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 157 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r--r-x\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 158 | |
| 159 | rm -rf dir file && mkdir dir && touch file |
| 160 | testing "chmod o-r dir file" "chmod o-r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 161 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-x--x\n-rw-r-----\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 162 | |
| 163 | rm -rf dir file && mkdir dir && touch file |
| 164 | testing "chmod o-w dir file" "chmod o-w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 165 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 166 | |
| 167 | rm -rf dir file && mkdir dir && touch file |
| 168 | testing "chmod o-x dir file" "chmod o-x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 169 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr--\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 170 | |
| 171 | rm -rf dir file && mkdir dir && touch file |
| 172 | testing "chmod a=r dir file" "chmod a=r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 173 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "dr--r--r--\n-r--r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 174 | |
| 175 | rm -rf dir file && mkdir dir && touch file |
| 176 | testing "chmod a=w dir file" "chmod a=w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 177 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "d-w--w--w-\n--w--w--w-\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 178 | |
| 179 | rm -rf dir file && mkdir dir && touch file |
| 180 | testing "chmod a=x dir file" "chmod a=x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 181 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "d--x--x--x\n---x--x--x\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 182 | |
| 183 | rm -rf dir file && mkdir dir && touch file |
| 184 | testing "chmod a+r dir file" "chmod a+r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 185 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 186 | |
| 187 | rm -rf dir file && mkdir dir && touch file |
| 188 | testing "chmod a+w dir file" "chmod a+w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 189 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxrwxrwx\n-rw-rw-rw-\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 190 | |
| 191 | rm -rf dir file && mkdir dir && touch file |
| 192 | testing "chmod a+x dir file" "chmod a+x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 193 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rwxr-xr-x\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 194 | |
| 195 | rm -rf dir file && mkdir dir && touch file |
| 196 | testing "chmod a-r dir file" "chmod a-r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 197 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "d-wx--x--x\n--w-------\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 198 | |
| 199 | rm -rf dir file && mkdir dir && touch file |
| 200 | testing "chmod a-w dir file" "chmod a-w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 201 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "dr-xr-xr-x\n-r--r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 202 | |
| 203 | rm -rf dir file && mkdir dir && touch file |
| 204 | testing "chmod a-x dir file" "chmod a-x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 205 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drw-r--r--\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 206 | |
| 207 | rm -rf dir file && mkdir dir && touch file |
| 208 | testing "chmod =r dir file" "chmod =r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 209 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "dr--r--r--\n-r--r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 210 | |
| 211 | rm -rf dir file && mkdir dir && touch file |
| 212 | testing "chmod =w dir file" "chmod =w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 213 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "d-w-------\n--w-------\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 214 | |
| 215 | rm -rf dir file && mkdir dir && touch file |
| 216 | testing "chmod =x dir file" "chmod =x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 217 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "d--x--x--x\n---x--x--x\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 218 | |
| 219 | rm -rf dir file && mkdir dir && touch file |
| 220 | testing "chmod +r dir file" "chmod +r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 221 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 222 | |
| 223 | rm -rf dir file && mkdir dir && touch file |
| 224 | testing "chmod +w dir file" "chmod +w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 225 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 226 | |
| 227 | rm -rf dir file && mkdir dir && touch file |
| 228 | testing "chmod +x dir file" "chmod +x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 229 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drwxr-xr-x\n-rwxr-xr-x\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 230 | |
| 231 | rm -rf dir file && mkdir dir && touch file |
| 232 | testing "chmod -r dir file" "chmod -r dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 233 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "d-wx--x--x\n--w-------\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 234 | |
| 235 | rm -rf dir file && mkdir dir && touch file |
| 236 | testing "chmod -w dir file" "chmod -w dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 237 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "dr-xr-xr-x\n-r--r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 238 | |
| 239 | rm -rf dir file && mkdir dir && touch file |
| 240 | testing "chmod -x dir file" "chmod -x dir file && |
Divya Kothari | 207b6a6 | 2014-09-03 13:32:32 -0500 | [diff] [blame] | 241 | ls -ld dir file | cut -d' ' -f 1 | cut -d. -f 1" "drw-r--r--\n-rw-r--r--\n" "" "" |
Divya Kothari | ef0ed68 | 2014-07-04 21:20:02 -0500 | [diff] [blame] | 242 | |
| 243 | # Removing test files for cleanup purpose |
| 244 | rm -rf dir file |