Skip to content

Instantly share code, notes, and snippets.

@prakhar1989
Forked from danielrw7/ replify
Created August 19, 2016 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prakhar1989/9e5adf61231c95b1346743ff915ec2cb to your computer and use it in GitHub Desktop.
Save prakhar1989/9e5adf61231c95b1346743ff915ec2cb to your computer and use it in GitHub Desktop.
replify - Create a REPL for any command
#!/bin/sh
command="${*}"
printf "Initialized REPL for [%s]\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "\n%s> " "$command"
read -r input
done

HN Discussion

$ replify echo
Initialized REPL for [echo]
echo> "Hello, World!" 
Hello, World!

echo> "It works!"
It works!

$ replify git
Initialized REPL for [git]
git> init
Initialized empty Git repository in /ebs1/html/test/.git/

git> remote add origin https://your-url/repo.git                

git> checkout -b new-branch
Switched to a new branch 'new-branch'

git> push   

See mchav/With for a similar tool that has more features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment