view bin/f @ 10304:7d14a8891360

<oerjan> sled bin/slashlearn//2s,\'.*\',\'Usage: `le/[/]rn <key>//<wisdom>\',
author HackBot
date Fri, 17 Feb 2017 02:40:08 +0000
parents c989a1669243
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