99 questions linked to/from Understanding "IFS= read -r line"
Keep \ in read variable to show space [duplicate]
Trying to keep spaces in the variable for read with the \. $ echo "Drag folder to be copied to terminal and press ENTER." $ read FILE /Users/UserName/Desktop/Folder\ With\ Spaces\ In\ it $ echo "$...
How is it possible that this doesn't work even if you use quotes?
I know that to deal with spaces in file names you should wrap the entire file name between quotes but this is not working for this script, indeed what is happening is the exact opposite, it only works ...
Looping through contents of a file and finding it in different directory
I need to compare the contents of a file located in dir A with actual files in different directory. ex- directory A has a file test.txt , Item mentioned in test.txt and not present in directory B ...
Unable to iterate over all files in bash in archlinux's docker container?
I am running a bash script : #!/bin/bash touch archlinux_log.txt touch packages_not_in_archlinux.txt while read line; do if pacman -Q --info $line ; then pacman -Q --info $line >&...
Why the sed command is not replacing the pattern inside a shell script?
I am trying to prepare a shell script to include several chained sed commands. I am using /bin/sh in FreeBSD 12. Which seems to be POSIX compliant (see man page here). This is what I have tried, it ...
How can I check if a given string matches any of the items in an array?
I have a list of directories. Some of them have a pattern in their names. I made an array for those patterns. Then I should loop over a find result, and compare each result with each pattern and if it ...
find command also includes the current dir in the result which is not required to be moved
I am trying to write a script where I can find files larger than a certain size and then move them to another dir but the find command also includes the current dir in the result which is not required ...
What's a clean way to run a specific command C for each line L of a given file F and then move every L where C(L) ran unsuccesfully?
Say that https://example.nosuchtld https://example.net https://example.org https://example.willfail is the content of urls.txt. I want to run <command> <url> for every URL/line of urls....
Can't capture the output of git pull command in a variable
I run git -C /another-directory pull and I get this error: Your configuration specifies to merge with the ref 'refs/heads/main' from the remote, but no such ref was fetched. Now I want to get that ...