Skip to content

Instantly share code, notes, and snippets.

@mick
Created November 30, 2009 23:56
Show Gist options
  • Save mick/245898 to your computer and use it in GitHub Desktop.
Save mick/245898 to your computer and use it in GitHub Desktop.
loops the hadoop fs shell command to make it interactive
#!/bin/bash
# starts an interactive shell to the hadoop file system.
# Written by David M. Thompson, 2009
CMD="hadoop fs -"
echo
while [ 1 ]
do
echo -n "hdfs> "
read ANSWER
if [ "$ANSWER" == 'exit' ]
then
break
fi
$CMD$ANSWER
done
echo "goodbye."
@michaelzhou999
Copy link

Nice and handy. Would be better if we add handling if user hits enter key. Something like this,

     if [ "$ANSWER" == '' ]
       then  
            continue
       fi

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