Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash variable in string

${!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 :: add fold to path in linux 
Shell :: copy a file from local machine to docker container 
Shell :: ionic 4 image zoom 
Shell :: Delete non empty folder 
Shell :: how to active telnet on windows 10 telnet 
Shell :: changng truffle build directory 
Shell :: how to set the push.default 
Shell :: install svgo linux 
Shell :: docker splunk run 
Shell :: asp.net existing database 
Shell :: how to extract doi from rtf file 
Shell :: bash dynamic varibale 
Shell :: how to add branches 
Shell :: install Dagger 2 in Android studio 
Shell :: brownie list networks 
Shell :: git stash pop resolve conflict 
Shell :: p4merge git config 
Shell :: install sonic visualizer ubuntu 
Shell :: avd manger permission need root 
Shell :: how to remove directory with contents in w10 cmd 
Shell :: replace spaces with hypen in file names linux 
Shell :: linux user expiration 
Shell :: vnc share single window 
Shell :: how to merge child branch to master branch in git 
Shell :: homestead.yaml adding provisions 
Shell :: Install DatadogRum 
Shell :: docker run -p port:port meaning 
Shell :: how to run a specific knex seed file 
Shell :: laravel installer version 
Shell :: What next after installing sanctum for laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =