Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

double quotes inside double quotes bash

'"'"'something'"'"' is equivalent to 'something'
"'"'"something"'"'" is equivalent to "something"

#Example usage
echo "hey "Dora""
>>hey Dora
echo "hey "'"'"Dora"'"'""
>>hey "Dora"
Comment

bash single vs double quotes

# Short answer:
# Single quotes don't allow interpolation, but double quotes do

# Long answer:
# From Wikipedia:
# In computer programming, string interpolation (or variable interpolation,
# 	variable substitution, or variable expansion) is the process of evaluating
# 	a string literal containing one or more placeholders, yielding a result in
# 	which the placeholders are replaced with their corresponding values.

# Concrete example:
echo "$(echo 'word')" # here, "$(echo 'word')" gets interpolated (interpreted)
--> word

echo '$(echo "word")' # here, '$(echo "word")' is echoed literally (no interpolation)
--> $(echo "word")

# Note, this link also has some good info:
https://stackoverflow.com/questions/10067266/when-should-i-wrap-quotes-around-a-shell-variable/42104627#42104627
Comment

PREVIOUS NEXT
Code Example
Shell :: list packages linux windows 
Shell :: install x server wsl2 
Shell :: downgrade cocoapods in mac m1 
Shell :: git add submodule branch 
Shell :: pyinstaller failed to execute script pyi_rth_pkgres 
Shell :: nvm install stable not found 
Shell :: generate pfx certificate 
Shell :: how to list running processes in linux 
Shell :: docker run name 
Shell :: HOW TO REPLACE A CHARACTER FROM A STRING IN BASH 
Shell :: install docker wsl 
Shell :: install vim mac 
Shell :: install leafpad ubuntu 2021 
Shell :: ubuntu install arial font 
Shell :: prolog how to run 
Shell :: gitlab ee version check 
Shell :: docker compose install debian 
Shell :: search git -G 
Shell :: bash get dir of file 
Shell :: como configurar git e github 
Shell :: sed add line after match 
Shell :: virtual host apache2 
Shell :: git revert merge 
Shell :: powershell to string 
Shell :: centos speedtest 
Shell :: php.ini ubuntu 
Shell :: wireshark para ubuntu 
Shell :: Remove all your local git branches but keep master 
Shell :: git reset hard for remote 
Shell :: powershell check if user is admin 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =