Mercurial > repo
changeset 7763:6abca43f97a0
<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 echo no such file: "$f"; else "$cmd" "$(< "$f")"; fi\' > bin/f
author | HackBot |
---|---|
date | Wed, 04 May 2016 21:39:37 +0000 |
parents | a48fbda8ca03 |
children | de0c23a5db21 |
files | bin/f |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/f Wed May 04 21:37:41 2016 +0000 +++ b/bin/f Wed May 04 21:39:37 2016 +0000 @@ -3,4 +3,4 @@ shift f="$*" if [[ -z "$f" && "$cmd" == *\ * ]]; then f="${cmd#* }"; cmd="${cmd%% *}"; fi -if [[ -z "$f" ]]; then echo try: \`f command filename; else "$cmd" "$(< "$f")"; fi +if [[ -z "$f" ]]; then echo try: \`f command filename; elif [[ \! -e "$f" ]]; then echo no such file: "$f"; else "$cmd" "$(< "$f")"; fi