Skip to content

Instantly share code, notes, and snippets.

@deepakshrma
Created April 13, 2019 04:42
Show Gist options
  • Save deepakshrma/d2120c81c860363a241aed814398dd93 to your computer and use it in GitHub Desktop.
Save deepakshrma/d2120c81c860363a241aed814398dd93 to your computer and use it in GitHub Desktop.
My Shell command, Run continuous commands in given shell.
#!/bin/bash
COMMAND=$1
RESET="\033[0m"
BOLD="\033[1m"
YELLOW="\033[38;5;11m"
echo "running in $COMMAND shell mode"
while read -r -p "$(echo -e $BOLD$YELLOW"$COMMAND>"$RESET)"
do
if [ "$REPLY" == "quit" ]; then
echo "Quiting $COMMAND shell"
exit 0
else
eval "$COMMAND $REPLY"
fi
done
## Example
## ./shell.sh npm
## npm>ls
## Output:
# /Users/xdeepakv
# └── (empty)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment