Linked Questions

1 vote
0 answers
105 views

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 "$...
  • 65
1 vote
1 answer
81 views

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 ...
user avatar
0 votes
2 answers
100 views

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 ...
0 votes
1 answer
39 views

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 >&...
  • 171
0 votes
2 answers
62 views

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 ...
  • 579
0 votes
1 answer
60 views

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 ...
0 votes
1 answer
41 views

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 ...
  • 1
0 votes
2 answers
48 views

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....
0 votes
1 answer
28 views

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 ...

15 30 50 per page
1
3 4 5 6
7