Skip to content

Tag: bash

create multiple file with content in linux with user input

I’m new in bash scripting and I’m trying to create a bash script which can create multiple file with content (around 10000 lines [no matters what text]) but with user input. I made a script which create files (see below) but how can I fill each file with 10000 lines? Thank you in advance! Answer Replace your touch command with

Execute a command on all the files within a directory

I am trying to write a bash script that could automate a programme on all the files present in a directory. The files that are in my directory are in the .nii or .nii.gz format. The command that I have to write is InputFile is the name of the file that has to be processed by the programme, and OutputFile

Find and Execute Scripts in Subdirectories

I have a filesystem structured like this: Parent Directory orchestrator Subdir1 Subdir2 Subdir3 Within the, I have: This works for the most part, but it is fragile. If one of the scripts encounters a problem, the script stops. I’d like for it to continue on to the next script if this happens.

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 the terminal as

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 field in the loop

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:

Docker run with arguments from a configuration file

I’ve built a docker image in order to publish a jupyter notebook to my team. The jupyter notebook runs inside a docker container by running a docker run command containing numerous arguments (such as mounts and environment variables for AWS credentials). The current instructions I published for running the docker require you to copy and paste the entire docker run