I want to write a shell script which takes as input a valid path, and the script lists the first n (also a parameter) lines of all the files from the repository and sub repositories where the user who launched the script has read and write privileges. Is there a command that would allow me to do this? I believe
Tag: shell
How can I loop for end of month date between to dates in sh?
I want to loop and print end of month date between two dates. I have below code but it prints day on day. but I want these result for: 20210131 20210228 20210331 thanks in advance Answer Something like this or with -m flag
Bash script return to menu if status code inside of a while loop [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 2 years ago. Improve this question I’m doing a bash script to check cryptocurrency prices, and it updates in a while loop like this: Crypto prices real time updating While loop
How can I build a Trap function with any key
This function exits my script when I press cntr+C, how can i modify it to make it works when I press enter? Answer This might help:
Redirect file in linux using length [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 2 years ago. Improve this question Am trying to redirect the file based on the length. I have a file having the value, I like Linux I have to create a
how to run complex awk command on remote machine
I am trying to capture the total used memory in % on remote machine as the following so we add backslash as before the “$” as but still with the same errors any advice how to fix this syntax? Answer You also have to escape the double quotes “:
pass the date from outside as a parameter
This is my Linux script, I want to ask the user from outside what date is needed, then save that date and run the script for that date. now currently this script generate a csv for the current date files, I want to run this for a user request date, can I pass parameters from outside? any help could be
awk renamed few files and left few to renamed
I am trying to replace part of filenames based on matching string of filename from another file. Filenames are in following format: where digits before first _ represent station code, which I want to replace with its station name from another file named radiosonde.csv. For example : I want change 36872_20190806_00.csv to ALMATY_20190806_00.csv change 38064_20190806_00.csvto KYZYLORDA_20190806_00.csv Data of radiosonde is
Sed to replace a speccificc part of line by argument in shell script based in line number
I have a script test.sh He has some arguments like : I made a while read loop to replace each specific part of a line (extractReplaceArgLine) with argument passed in shell script (Forest Cuba World Hello). Consider the file test.txt : So, the output would be : How can I do that ? Thanks ! Answer Use $1 to get
Any idea how i can use timeout command with condition in linux and shell script
aim working on some shell script , i would like to check the following command df -h if timeout more than 60 second then echo “error ” else pass. so if this command will not responding for 1 minute then I will receive and error message , otherwise it will pass , any creative idea will be high apricated .