A
A
avtorlego2017-11-13 20:10:34
bash
avtorlego, 2017-11-13 20:10:34

How not to replace a variable in sh script?

echo "alias uphp='php /etc/uphp/main.php $PWD'" >> ~/.bashrc
- in this case, you do not need to replace the variable, but write it to the file like this: alias uphp='php /etc/uphp/main.php $PWD'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Koryukov, 2017-11-13
@avtorlego

put a backslash before the dollar? not?

M
mureevms, 2017-11-13
@mureevms

Use single quotes. Variables inside them are not passed and the data is displayed as is:
Or, if the expression needs to be in quotes:

echo 'alias uphp="php /etc/uphp/main.php $PWD"' >> ~/.bashrc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question