[Toybox] Add -m option to mkdir

Felix Janda felix.janda at posteo.de
Sun Dec 23 12:41:56 PST 2012


On 12/23/12 at 08:31pm, Bastian Bittorf wrote:
> * Felix Janda <felix.janda at posteo.de> [23.12.2012 20:23]:
> > Hi,
> > 
> > of created directory), the other adds a test script for it. The test script
> > uses the non-standard command stat since it seems to be the right tool for
> > determining permissions of directories.
> 
> i you really want to avoid 'stat' you could use something like:
> 
> case "$( ls -l "$file" )" in
> 	"-rwxr-xr-x"*)
> 		# true
> 	;;
> 	*)
> 		# error
> 	;;
> esac
> 
> OR
> 
> ls -l "$file" | grep -q ^"-rwxr-xr-x" && ...
> 
> 
> bye, bastian

Thanks. I had somehow in mind that parsing the output of ls should be
avoided (http://mywiki.wooledge.org/ParsingLs), but in this case we can
control the filenames and the permissions are even right at the beginning
of ls's output.

So maybe one should use ls rather than stat.

Felix

 1356295316.0


More information about the Toybox mailing list