0
I made a small script in Python that transformed a file .py
in a Linux bash script, however, the quotes that are inside the Python file end up making the script not work. Is there any way I can turn them all "
of a bash text on \"
?
The script I made is this:
#!/bin/bash
pyprog=$(cat $1) # Salva nessa variável o texto do arquivo python
echo "#!/bin/bash
echo \"$pyprog\" | python" > $2
# A saída final desse programa seria algo parecido com:
# !bin bash
# echo "print "Exemplo de um programa em python"" | python
# Assim aspas do comando print vão interferir nas aspas do comando echo
# Neste caso eu precisaria que o script automaticamente transformasse para
# echo "print \"Exemplo de um programa em python\"" | python
Use the backslash
\"
to rid the"
who doesn’t want me to command himecho
interpreter.– Alessandro Schneider