Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash 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

bash get text inside quotes

# <command which return text containing quotes> | cut -d " -f2
VBoxManage list vms | cut -d " -f2
Comment

PREVIOUS NEXT
Code Example
Shell :: git change branch remote 
Shell :: netstat pid 
Shell :: how to install ssl certificate in aws lightsail 
Shell :: gcloud check region 
Shell :: su: failed to execute /bin/bash: Resource temporarily unavailable 
Shell :: TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined at validateString (internal/validators.js:120:11) 
Shell :: check ip address linux 
Shell :: VCINSTALLDIR not set, not running in VS Command Prompt 
Shell :: gitignore for eclipse 
Shell :: git update gitignore remove files 
Shell :: git checkout branch and update submodules 
Shell :: pdf to jpg terminal 
Shell :: xampp apache not starting 
Shell :: run file linux 
Shell :: pwd linux 
Shell :: How install packages from package.tar.gz on rstudio 
Shell :: git clone latest commit 
Shell :: pip install requireents 
Shell :: how to enable autostart apache 
Shell :: silent install google chrome 
Shell :: how to run script in linux at startup 
Shell :: debian without gui 
Shell :: wsl file 
Shell :: bash count lines 
Shell :: disable iptables debian 
Shell :: delete git stash list 
Shell :: install conan 
Shell :: powershell export-excel 
Shell :: git command history 
Shell :: how to set git password 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =