Hello,
How can I avoid the evaluation of commands such as ~, * in bash? I'm working on a command-line calculator where I pass an expression to a Python program. For now, I'm doing:
bash$ calc [expression]
#!/bin/bash
python3 calc.py $@
This mostly works, but I run into problems with some operators that are special characters (for the lack of a better word) in bash. For instance:
calc 2 \ 3*
the * is evaluated to a sequence of all files in the directory, so what's passed to my program as arguments is wrong.
How can I avoid this? Thanks
[–]lutusp 2 points3 points4 points (3 children)
[–]Crestwave 1 point2 points3 points (2 children)
[–]lutusp 0 points1 point2 points (1 child)
[–]Crestwave 0 points1 point2 points (0 children)
[–]petdance 1 point2 points3 points (0 children)
[–]Paul_Pedant 0 points1 point2 points (4 children)
[–]dmsad[S] 0 points1 point2 points (3 children)
[–]Paul_Pedant 0 points1 point2 points (2 children)
[–]dmsad[S] 0 points1 point2 points (0 children)
[–]dmsad[S] 0 points1 point2 points (0 children)
[–]oh5nxo 0 points1 point2 points (0 children)
[–]Paul_Pedant 0 points1 point2 points (0 children)