annotate bin/f @ 12254:616be78bd12e draft

<oerjan> revert
author HackEso <hackeso@esolangs.org>
date Fri, 06 Dec 2019 07:54:58 +0000
parents c989a1669243
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9075
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
1 #! /bin/bash
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
2 cmd="$1"
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
3 shift
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
4 f="$*"
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
5 if [[ -z "$f" && "$cmd" == *\ * ]]; then f="${cmd#* }"; cmd="${cmd%% *}"; fi
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
6 if [[ -z "$f" ]]; then echo try: \`f command filename; elif [[ -e "$f" ]]; then "$cmd" "$(< "$f")"; else echo no such file: "$f"; fi