Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash nested for loop one line

# Basic syntax:
for i in a b; do for j in c d; do echo $i $j; done; done
# Where:
#	- each do statement has to end with a semicolon. *This is why there is
#		a semicolon after the first done
#	- multiple commands can be passed to each for loop, they just need to be
#		separated by semicolons
#	- for more complex for operations, sometimes it can be helpful to surround
#		the do statements with parentheses, e.g.:
#		for word in $(more words.txt); do (printf "$word
" & for file in $(ls *); do (grep $word $file -c); done;) done >> output.txt
Comment

PREVIOUS NEXT
Code Example
Shell :: get full path of files in directory linux command 
Shell :: how to run .run file in linux 
Shell :: move file from one directory to another sftp 
Shell :: git see local changes 
Shell :: add job to crontab 
Shell :: ngrok download authtoken 
Shell :: how to update to latest LTS version of ubuntu 
Shell :: start kafka cmd 
Shell :: slugify npm 
Shell :: Failed to install the following Android SDK packages as some licences have not been accepted. build-tools;28.0.3 Android SDK Build-Tools 28.0.3 platforms;android-29 Android SDK Platform 29 
Shell :: check and verify git version 
Shell :: bash sh: line [: too many arguments 
Shell :: count number of lines in directory linux 
Shell :: how to still atom on ubuntu 
Shell :: install vue-material 
Shell :: 15 second rubber ducky password 
Shell :: git push specify ssh key 
Shell :: powershell print environment variables 
Shell :: how to install node dependencies 
Shell :: raspberry pi scan networks 
Shell :: view live log linux 
Shell :: delete logs older than 7 days linux 
Shell :: how to setup display xServer wsl win10 
Shell :: how to install gnu lib tool 
Shell :: pytest suppress exit code 
Shell :: run bat file with arguments 
Shell :: Go install /linux 
Shell :: how to install dpkg in ubuntu 
Shell :: how do I list all my packages on arch linux 
Shell :: flutter : command not found 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =