Support Questions

Find answers, ask questions, and share your expertise

Executing shell commands from beeline shell

avatar
New Contributor

Is it possible to use Shell command from Beeline Shell? Just like we can use shell command from the hive as !ls or !cat. Please let me know while I am trying to use the !ls command it is not working from beeline but it works fine in the hive.

,

I have a question regarding running a shell command from beeline...As we can run Shell command from hive shell like: !ls,!cat etc.

Is it possible to run shell command from Beeline shell.....I tried but its shows undefined or unnamed syntax. Could you Please help me with this.

3 REPLIES 3

avatar
Super Collaborator

Yes, use !sh before the command. For example:

!sh ls

!sh cat <filename>

avatar
New Contributor

It seems to work only form command without parameters. If I define a variable by set hivevar:varname=value I cannot refer this variable. I.E !sh echo ${hivevar:varname} does not not return the string 'value' but the string '${hivevar:varaname}. Any idea to pass values to the command issued after the !sh?

 

avatar
Community Manager

@larnone  As this is an older post, we recommend starting a new thread. The new thread will provide the opportunity to provide details specific to your environment that could aid others in providing a more accurate answer to your question.


Cy Jervis, Manager, Community Program
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.