[Solved] How to stop vbash swallowing question marks?

Hi,

after pasting this demo code into an vyos ssh-terminal the question mark has gone:

vbash-4.1# cat << 'EOF' > /tmp/test.txt
echo "How to configure vbash to stop swallowing the question mark?"
EOF

# Note: The question mark is missing.
cat /tmp/test.txt

Is there an option, parameter, or setting that stops vbash from intercepting and interpreting question marks as help-request?

Thanks a lot for your feedback,

Best regards,
vyozzy

I dont see any output of that “cat /tmp/test.txt” in your post?

Please try it yourself - paste the code into a vyos terminal and see. Thanks!

I dont have any up2date VyOS running currently.

You would get better help in the forum if you pasted which output you got vs what you expected.

Have you tried to assign that to a variable first something like:

TEXTVAR="Text?"
echo "${TEXTVAR}"

You could also try to escape it to see if that makes any difference something like:

echo "Text\?"

yes I’ve tried my best already. As long as you paste the question mark (whether plain or assigned to an variable is irrelevant) it gets swallowed.

Regarding the output:

The output of the cat command is lacking the string’s final question mark. Simple as that. It’s really annoying, if you paste for example a dyndns update url which naturally contains a ?-seperator.

Question mark is fine for me when both viewing the file, and running it with bash:

root@NPB7:/home/l0crian# cat /tmp/test.txt 
echo "How to configure vbash to stop swallowing the question mark?"
root@NPB7:/home/l0crian# sudo bash /tmp/test.txt 
How to configure vbash to stop swallowing the question mark?

Ah. Thanks for your feedback. Perhaps a client issue. I don’t know what’s going on here (I use Windows 10 + putty). vyos 1.5-nightly runs as KVM on proxmox.

If I type (type, not paste) a question mark sign (?) into a console vyos prompts:

Possible completions:
  confirm               Confirm prior commit-confirm
  comment               Add comment to this configuration element
  commit                Commit the current set of changes
  commit-confirm        Commit the current set of changes with 'confirm' required
  compare               Compare configuration revisions
  copy                  Copy a configuration element
  delete                Delete a configuration element
  discard               Discard uncommitted changes
  edit                  Edit a sub-element
  exit                  Exit from this configuration level
  load                  Load configuration from a file and replace running configuration
  merge                 Load configuration from a file and merge running configuration
  rename                Rename a configuration element
  rollback              Rollback to a prior config revision (requires reboot)
  rollback-soft         Rollback to a prior config revision (without reboot)
  run                   Run an operational-mode command
  save                  Save configuration to a file
  set                   Set the value of a parameter or create a new element

I’m pasting with SecureCRT for reference. You may need to escape the character as Apachez mentioned if the term software has different behavior.

Yeah, that’s typical behavior. Just type Ctrl+v before typing it.

That’s interesting! Thanks a lot - how can I setup, configure vbash to not react on ? anymore?

Easiest way is to not do it directly from op or conf mode. Drop into the linux shell with sudo su

Ha ha, that was easy :wink: Thank you very much!

No problem, glad you got it sorted.

I usually use sudo -s, which doesn’t worked here.

Any difference if your head of your script is properly setup such as this?

#!/bin/vbash

# Include VyOS functions                        
source /opt/vyatta/etc/functions/script-template

# The rest of your stuff
xxx

As said before: as long as you paste (aka type) a “?” the problem persist. @L0crian’s workaround is fine for me.

Nevertheless, I gave your suggestion a last chance: Pasting this code …

#!/bin/vbash

# Include VyOS functions                        
source /opt/vyatta/etc/functions/script-template

# The rest of your stuff
echo "Where is the "?"? Gone?"

… produces this output:

vbash-4.1# #!/bin/vbash
vbash-4.1#
vbash-4.1# # Include VyOS functions
vbash-4.1# source /opt/vyatta/etc/functions/script-template
vbash: /opt/vyatta/share/vyatta-cfg/functions/interpreter/vyatta-cfg-run: line 198: syntax error near unexpected token `('
vbash: /opt/vyatta/share/vyatta-cfg/functions/interpreter/vyatta-cfg-run: line 198: `reboot ()'

  Invalid command: [reset_edit_level]


  Invalid command: [_vyatta_cfg_init]

vbash-4.1#
vbash-4.1# # The rest of your stuff
vbash-4.1# echo "Where is the "" Gone"^C

The question marks are gone.

I wonder if you got something else screwed up with your installation…

Could be, but I don’t think so. The behavior seems reasonable to me - not nice but reasonable. Nevertheless, I’ll reset the test system soon, to install it from scratch, checking whether my setup works out of the box. Afterwards I will check the ?-problem one last time. sudo su is ok for me.

Reasonable?

You shouldnt get those errors at all to begin with so try to reinstall your box.

Also the lines should be in a single file such as “test.sh” which you make executable with “chmod +x ./test.sh” and then run it with “./test.sh”.

As I said, believe me or try it yourself and you’ll see. Install a 1.5-nightly, type:

configure
?

And yes, the swallowed question mark seems reasonable - in the sense of well-founded - to me.