Skip to content
Advertisement

Tag: scripting

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

how to write Bash script for getting Public ip address in a way that when one command failed then it have to execute another command

i want to write a bash script in a way that if one command gets failed then it will have to execute another command. For example:- “curl www.ifconfig.me” if this command gets failed then another command “curl http://icanhazip.com” to get execute and should show the output. Answer If you want the HTTP code, try this: Then: After that, you could

I am unable to type cast string to integer in csh

I want to fetch out ‘-0.5’ from the file example.txt and add 1 to it. Although I am able to fetch out ‘-0.5’. but I am unable to add 1 to it, maybe because -0.5 is considered as a string and not a integer. Code: Obtained Result: Expected Result: How do I type cast -0.5 to integer? Answer csh doesn’t

how can i echo a line containing single quotes?

I want to echo a line containing single quotes but when I am echoing it, the output comes out without the quotes inside that line. I am using this echo rule_files: [ ‘${path.config}/folder/*.py’ ] and the output is rule_files: [ ${path.config}/folder/*.py ] I want the output to include the single quotes around the path. Answer You have to escape the

Advertisement