Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash store string in variable

${!var}	#Just use to use reference value inside another variable ;)
Comment

bash use variable in string

domain='http://www.whitehouse.gov'
path='/some/path'
base_url="$domain$path"
Comment

Example of Bash Variable in String

echo "***Assigning a variable***"
Var_1="Softhunt"
echo "***Printing Var_1 which is assigned value of Softhunt.net***"
echo $Var_1
echo "***Printing Var_2 which is not assigned***"
echo "***Nothing gets printed!***"
Var_start="https://www."
Var_end=".net"
echo $Var_start$Var_1$Var_end
echo "***Sequence keyword will print 1 to 4 in different lines***"
seq 1 4
echo "***The following command will print it in single line***"
echo $(seq 1 4)
echo "***Arthmetical operator to add 2 numbers entered by users: 2 and 3"
echo $((2+3))
echo "***Using bc utility to restrict the number of decimals***"
echo "7.5 / 2.1" | bc
echo "***Using bc utility to not restrict the number of decimals***"
echo "7.5 / 2.1" | bc -l
Comment

PREVIOUS NEXT
Code Example
Shell :: git commit with message 
Shell :: how to turn off screenkey 
Shell :: kali linux nit signing in 
Shell :: github pdftron 
Shell :: bash cd root permission denied 
Shell :: java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_FAILED_VERSION_DOWNGRADE: Package Verification Result 
Shell :: branch creation 
Shell :: btop++ on ubuntu 
Shell :: bash setting home 
Shell :: how to scp from vm to local 
Shell :: powershell which equivalent 
Shell :: proxmox upgrade 
Shell :: create self signed certificate 
Shell :: how to remove file from directory in linux 
Shell :: mount a folder from windows inside wsl 
Shell :: stash with name 
Shell :: ubuntu bash script exit when error 
Shell :: Update /etc/apt/sources.list file 
Shell :: rsync delete old files 
Shell :: shell script syntax error unexpected end of file 
Shell :: install font in react native 
Shell :: pip install datetime 
Shell :: if else bash 
Shell :: apt package manager 
Shell :: make kernel module 
Shell :: git push origin cannot be resolved to branch 
Shell :: how to make conda to use global packages 
Shell :: update centos kernel version yum 
Shell :: bash delete a command line 
Shell :: vim set paste 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =