简体   繁体   中英

Writing aliases

I want to write an alias that does the following:

  • The user's (owner's) permissions are unchanged.
  • All group and world (others) permissions are set so they do not allow any access to the file - read, write, or execute
private () {
  chmod go-rwx "$@"
}

I believe this does exactly what you want. It defines a shell function using Posix syntax that works with every Posix shell, not just bash. It works on any number of files.

It removes rwx permission bits from only the group and others, leaving the user permissions as whatever they previously were.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM