Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 3 years ago. Improve this question I nee…
Tag: bash
Why does the file in a subdirectory not get copied?
I have to make a script which will copy all files from a certain location starting with “db.” to another location. My script works fine for all files which are directly in the directory, but it doesnt copy any files which are in subdirectorys. I have used the parameter -r, which should copy everyt…
How do I copy files in the same directory with a number changed of filename
I would like to copy mutiple files using patterns for a new file name. For example: How do I copy these files into the following filename automatically using bash-script? Many thanks Answer This copies all files in the current directory, replacing 1 with 2. It’s not really useful as it serve a very spec…
Trouble redirecting an error in pipeline using Bash?
So I used this command to get all .conf files from /etc/. I want the output in total_size.txt and my errors in error.txt. My output looks good, but the errors won’t redirect to error.txt, they appear in my terminal: I don’t know what to do; I tried 2>> instead of 2> but it won’t wor…
Unable to use grep for a command and excecute the shell script?
I have created a shell script to execute 5 commands from a file called elist.txt The shell script is as follows output: Answer You can do this too. People usually do not recommend to use eval at all. Regards!
How to access local variables in remote server using ssh [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago. Improve this question I am trying to access my local variable in remote server. Which command should I use. Ex. cm…
bash shell script for loop
I have a bash shell script that loops through a server list file to verify a user exists on that server. My question is, I want the script to echo out which servers the user exists on before executing command: sleep; clear; main_sec <(this is a function) problem is as soon as that condition is met, it just…
Substituting string in a file by another string with leading zeros in linux
I have a text file filename for which I want to substitute a certain numerical string in row row_numby another one that starts with leading zeros. That row is: And I would like to substitute the last four digits so that the desired end result is: The command I am using is: The problem is that linux interprets…
Loop to filter out lines from apache log files
I have several apache access files that I would like to clean up a bit before I analyze them. I am trying to use grep in the following way: I have several terms that I want to grep, so I am piping every grep action as follow: Until here my rudimentary script works as expected! But I have many apache
Execute mirror and mget lftp commands in bash script
Current code Objective Download all csv files and mirror my local directory folder with the remote server, so when the code is run again it won’t download a second file. Error received open: *.csv: Name or service not known Comments From what I understood of the lftp man page I should be able to get all…