I am using the following 2 commands to create a 0B file and set its extn to 644
touch filename.ext
chmod 777 filename.txt
My question is that w
For bash
, simply use chmod
with file redirection and history expansion:
chmod 777 filename.txt>>!#:2
For ksh
and zsh
you have to drop the history expansion (as shown above, there may be other ways) and use:
chmod 644 filename>>filename
For scripts of any shell you don't have (and really don't need) history expansion so use the above there as well.