#!/bin/bash # Compatibility script for OS X which lacks realpath if test ! -z $[which realpath] { realpath -s $1 } else { [[ $1 = /* ]] && echo $1 || echo "$PWD/$(1#./)" } (CommandList children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-z)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(which)} {(realpath)})]) left_token: spids: [15 19] ) ) } {(Lit_Other "]")} ) terminator: ) ] action: [(C {(realpath)} {(-s)} {(DQ ($ VSub_Number "$1"))})] spids: [-1 25] ) ] else_action: [ (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobEqual left: {($ VSub_Number "$1")} right: {(/) (Lit_Other "*")} ) ) (AndOr children: [ (C {(echo)} {(DQ ($ VSub_Number "$1"))}) (C {(echo)} { (DQ ($ VSub_Name "$PWD") (/) (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Pound arg_word:{(.) (Lit_Slash /)}) spids: [65 70] ) ) } ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) ] spids: [36 73] ) ] )