Skip to content

Commit

Permalink
pass through any remaining parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
doekman committed Jun 14, 2018
1 parent b16f0e1 commit f65c1a3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ok
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ NC=$'\033[0m' # No Color
if [[ $1 =~ $re ]] ; then
# output the command first
cat .ok | echo -e "${CYAN}$ ${NC}$(sed $1'!d')" | sed -E "s/(#.*)\$/${BLUE}\1${NC}/1"
# save and remove argument. Remaining arguments are passwed to eval automatically
LINE_NR=$1
shift
# execute that line from the file
# TODO: pass through any remaining parameters, i.e ${@:2}
eval $( cat .ok | sed $1'!d' )
eval $( cat .ok | sed ${LINE_NR}'!d' )
else
# list the content of the file, with a number (1-based) before each line
cat .ok | awk -v z=$CYAN -v n=$NC '{print z "" ++i "." n " " $0 }' | sed -E "s/(#.*)\$/${BLUE}\1${NC}/1"
Expand Down

0 comments on commit f65c1a3

Please sign in to comment.