#!/bin/sh # print octal mode for a file # License: LGPLv2 if test $Argc -ne 1 { echo "Usage: $[basename $0] path" > !2 exit 1 } stat $1 | sed -n 's/^Access: (\([0-9]\{1,\}\).*/\1/p' (CommandList children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Pound "$#")} {(-ne)} {(1)} {(Lit_Other "]")}) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("Usage: ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Number "$0")})]) left_token: spids: [32 36] ) (" path") ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[40])] ) (C {(exit)} {(1)}) ] spids: [-1 25] ) ] spids: [-1 48] ) (Pipeline children: [ (C {(stat)} {($ VSub_Number "$1")}) (C {(sed)} {(-n)} {(SQ <"s/^Access: (\\([0-9]\\{1,\\}\\).*/\\1/p">)}) ] negated: False ) ] )