I am learning Cassandra right now.The problem is here
[cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh> q
... quit
... HELP
... !
... EXIT
...
... quit
... !
... EXIT
...
How can I quit the shell?
try
<control-c>exit<enter>
Yeah, what's happening above, is that cqlsh thinks that you're entering a multi-line command:
aploetz#cqlsh> q
... quit
... EXIT
... exit
... ;
Bad Request: line 1:0 no viable alternative at input 'q'
aploetz#cqlsh>
Note that when I provide a semi colon (;) it gets me back to the cqlsh command prompt. Then exit will work fine (even without a semicolon).
aploetz#cqlsh> exit
$
Official page also writes the exit command...
I just registred for this answer)
I find in docs, use command EXIT for it)
Just uppercase
Related
I am trying around the following highly used tools:
prettyjson
prettier
For example when I run the following on Powershell:
echo '{"a": 1}' | prettyjson
The terminal will just keep waiting for inputs till CTRL+C pressed and it exits with no expected output.
The workaround is to add .cmd to the command or just use cmd instead:
echo '{"a": 1}' | prettyjson.cmd
Outputs
a: 1
This seems to be a known limitation and a pull request is available:
https://github.com/npm/cmd-shim/pull/43
I need test some input data flow, and use 'IO.read', but after entering data i can't exit from this mode, CTRL-Z/X/C/D doesn't help (it terminates the whole iex). So how correct EOF command for this mode?
Thanks!
TL;DR: Use ^G followed by j, i [nn] and c [nn].
In both erl and iex shells you always might ^G to enter a “User switch command” mode. Type h for help there.
iex|1 ▶ IO.read :stdio, :all
^G
User switch command
--> j
1* {erlang,apply,[#Fun<Elixir.IEx.CLI.1.96155272>,[]]}
--> i 1
--> c 1
{:error, :interrupted}
iex|2 ▶
Sidenote: the correct EOF termination would be ^D in all the terminals. I honestly have no idea why it does not work as expected in erl/iex consoles.
I am trying to complete a lab report and I have just started using linux. I am really new to this ecosystem and I don't know how most of it works. I'm slowly learning from the labscript how to compile and execute C programs. However, after executing this statement
execute the output binary file using: $ ./myapp I am a student taking CMP 310
I lost the "$" sign and whenever I pressed enter this ">" would be printed before any statement and I couldn't execute or exit. If any of you could kindly explain what I did I would really appreciate it. Thank you.
You may have pasted an unmatched quote symbol, ' or " or a backtick ` and your terminal allows you to enter multiline statement and waits until you close the quote or backtick to evaluate it. To exit the multiline mode, either enter the closing character, or hit Ctrl-C, which in this case interrupts the input.
You have to paste only this part:
./myapp I am a student taking CMP 310
It tries to execute myapp executable file in your working directory (which ./ stands for), passing to it arguments I am a student taking CMP 310.
Me reproducing your problem:
16:45 $ "I have no idea what I am doing
> wut
>
>
> hello?
>
Most probably Ctrl+C will help you.
If you are working in GUI mode (not terminal) you can just close the window and open new shell session in new window.
This is my first ever post on stackoverflow, hope I don't break any rules. I'm a complete Linux newbie (installed Lubuntu 14.04 64bit last night) so be duly warned.
In short, I'm trying to get my laptop touchpad toggle to work (Fn+F3 on my Inspiron5110). I have a bash script:
#!/bin/bash
if [ $(synclient -l | grep TouchpadOff | awk '{print $3}') == 1 ] ; then
synclient touchpadoff=0;
else
synclient touchpadoff=1;
fi
I got it from http://crunchbang.org/forums/viewtopic.php?id=10996 . If I paste the script code in the terminal and execute it, it works (touchpad goes on/off). However, I want to bind it to a key so in my lubuntu-rc.xml I've added the following:
<!-- disable touchpad -->
<keybind key="XF86TouchpadToggle">
<action name="Execute">
<command>/usr/local/bin/touchpad.sh</command>
</action>
</keybind>
When I press the necessary key combo however I get "Failure to execute child process "/usr/local/bin/touchpad.sh" (No such file or directory)". However I can see in this directory, both in the file manager and when I use ls in the terminal that the file is there:
/usr/local/bin$ ls -l
total 4
-rwxrwxr-x 1 paspaldzhiev paspaldzhiev 145 юни 2 22:54 touchpad.sh
I used chmod +x touchpad.sh to make it executable.
Now, where this gets even more confusing:
If I use bash /usr/local/bin/touchpad.sh I get:
paspaldzhiev#areuexperienced:/usr/local/bin$ bash touchpad.sh
touchpad.sh: line 6: syntax error near unexpected token `fi'
touchpad.sh: line 6: `fi'
Though as I've said above I know for a fact that the code works if I just paste it in the terminal.
Further, if I use ./touchpad.sh I get :
paspaldzhiev#areuexperienced:/usr/local/bin$ ./touchpad.sh
bash: ./touchpad.sh: /bin/bash^M: bad interpreter: No such file or directory
Just to note that I'm not very sure what the difference between bash touchpad.sh and ./touchpad.sh is in terms of execution, it's just that my more Linux-savvy friends told me to try these :D.
In any case, I have no idea how to proceed henceforth, could anyone please shed a light on what I'm doing wrong?
Thank you very much!
The ^M in your last error msg is your big hint ; -). Somehow you have used a windows editor, file transfer or something. Try dos2unix touchpad.sh. It will remove all the CR (^M) chars from end of lines. It should work then. Good luck. – shellter
There is no need for script, since there is no need for if instruction.
Place this piece of code in your lubuntu-rc.xml
<keybind key="XF86TouchpadToggle">
<action name="Execute">
<command>synclient TouchpadOff=$((1-$(synclient | grep TouchpadOff | awk '{print $3}')))</command>
</action>
</keybind>
#! /bin/sh
VAR=(fdf fef fef)
for i in ${VAR}; do
echo i;
done
Code above has errors. I want to make shell take VAR as a separate string array, and get the output like this:
fdf
fef
fef
how to make it happen ? Thanks !
Try this:
VAR=(aa bb cc)
for i in "${VAR[#]}"
do
echo $i;
done
More info in this article.
The proposed solution only works when using bash. He must also have changed or removed the shebang, otherwise you'll get: syntax error: unexpected "(".
See also his follow up question: How come using ./shell.sh get error but . shell.sh works