Skip to content

Tag: bash

Find and Execute Scripts in Subdirectories

I have a filesystem structured like this: Parent Directory orchestrator init.sh Subdir1 install.sh Subdir2 install.sh Subdir3 install.sh Within the init.sh, I have: This works for the most part, but it is fragile. If one of the install.sh scripts encounters a problem, the init.sh script stops. I’d like …

How to save the text from a link in bash file?

I am trying to write a script that automatically makes a new website on my server. one of the steps is to go to this link and copy the salts into my wp-config.php file: https://api.wordpress.org/secret-key/1.1/salt/ I’m new to bash script and hoping this would be easy to do. I’m not sure if I need…

How does the neofetch ascii logo determine which color to use?

I am making custom ascii text-images for a cli app, and was curious how these custom colors are designed. Any ideas? Thank you, Answer If you look at neofetch script on it github page, and search for any distro to see the ascii logo, you will see some codes between some letters, this codes are interpreted by …

Bash – format .txt file into pover pivot form

txt file called without_Commas.txt. The content looks like this: I need to format this data to look like this: Is there a way to do this? Kind Regards Elias Answer On each line, this loops over all the field numbers starting with the third field. Then it prints the first field ($1) followed by the current fie…

delete all files except a pattern list file

I need to delete all the files in the current directory except a list of patterns that are described in a whitelist file (delete_whitelist.txt) like this: How can I perform this in one bash line? Answer Any bash script can fit on one line: Check the output and then, if it’s OK: