On 12/23/12 at 08:31pm, Bastian Bittorf wrote:
> * Felix Janda <[email protected]> [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
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to