

4·
9 days agoYou can actually do chmod +777,u+rwx,go-w foo to make the logic easier if you want to force a starting assumption.


You can actually do chmod +777,u+rwx,go-w foo to make the logic easier if you want to force a starting assumption.


Careful: chmod -X also looks for any existing exec bits:
$ umask 0
$ >foo >bar
$ ls -al foo bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 foo
$ chmod o+x foo
$ ls -al foo bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 bar
-rw-rw-rwx 1 user group 0 Sep 10 00:00 foo
$ chmod u=rwX,g=rX,o=rX foo bar
$ ls -al foo bar
-rw-r--r-- 1 user group 0 Sep 10 00:00 bar
-rwxr-xr-x 1 user group 0 Sep 10 00:00 foo


I like the way you think! Too bad a I replied to a seaming empty post some 26 min after you. I always disliked this about Reddit. Seeing someone rewording the top reply for karma.


You may want to learn about the shell’s “history expantion” functions. as an example:
~$ ls ~/Documents/taxes/tax_year_2012/2012-12-01.txt
/home/tom/Documents/taxes/tax_year_2012/2012-12-01.txt
~$ cd !!$:h
cd ~/Documents/taxes/tax_year_2012
~/Documents/tax_2012$ pwd
/home/tom/Documents/taxes/tax_year_2012
Here the string “!!$:h” is basically the last command’s [ !! ] last argument [], stripped of its last path component [:h].
Or there is ETIAS or, ESTA, ETA, K-ETA, etc.