Mercurial > repo
view bin/f @ 7764:de0c23a5db21
<fizzie> ` echo -e \'#! /bin/bash\\ncmd="$1"\\nshift\\nf="$*"\\nif [[ -z "$f" && "$cmd" == *\\\\ * ]]; then f="${cmd#* }"; cmd="${cmd%% *}"; fi\\nif [[ -z "$f" ]]; then echo try: \\\\`f command filename; elif [[ -e "$f" ]]; then "$cmd" "$(< "$f")"; else echo no such file: "$f"; fi\' > bin/f
author | HackBot |
---|---|
date | Wed, 04 May 2016 21:42:02 +0000 |
parents | 6abca43f97a0 |
children |
line wrap: on
line source
#! /bin/bash cmd="$1" shift f="$*" if [[ -z "$f" && "$cmd" == *\ * ]]; then f="${cmd#* }"; cmd="${cmd%% *}"; fi if [[ -z "$f" ]]; then echo try: \`f command filename; elif [[ -e "$f" ]]; then "$cmd" "$(< "$f")"; else echo no such file: "$f"; fi