You are not logged in.
[anon@anonpc .scripts]$ pkg="$(sed -n '2p' /home/anon/.scripts/dups)"
[anon@anonpc .scripts]$ echo $pkg
'e2fsprogs'
[anon@anonpc .scripts]$ ls /var/lib/pacman/local/ | grep $pkg
[anon@anonpc .scripts]$ ls /var/lib/pacman/local/ | grep 'e2fsprogs'
e2fsprogs-1.44.0-1
e2fsprogs-1.44.1-1
lib32-e2fsprogs-1.44.0-1
lib32-e2fsprogs-1.44.1-1
[anon@anonpc .scripts]$ ls /var/lib/pacman/local/ | grep 'e2fsprogs'
e2fsprogs-1.44.0-1
e2fsprogs-1.44.1-1
lib32-e2fsprogs-1.44.0-1
lib32-e2fsprogs-1.44.1-1
[anon@anonpc .scripts]$ As the code above shows, I define a variable and check to make sure it is defined as what I want. When I try to use the variable, nothing happens; it is as if I grep'd for something that wasn't actually there. However, when I grep for the name directly, everything shows up completely fine. I also copy/pasted the output of my variable (instead of typing the query directly), and it still works out fine.
What am I missing? What am I doing wrong? What is the right way to approach this? I am basically trying to make a simple search and replace for duplicate files.
Last edited by mntsv (2018-05-22 21:59:20)
Offline
I'm no bash expert, but I think you need to export the variable to make it available to sub-processes, in this case grep.
https://stackoverflow.com/questions/115 … out-export
Offline
hi,
the quotes are part of the variable, and thus are not interpreted as quotes.
printf '%s\n' /var/lib/pacman/local/${pkg//\'/}Last edited by N_BaH (2018-05-22 21:54:54)
Offline
Also don't grep ls, <lots of swearing here ;-)> use find or globbing.
Offline
Thanks N_BaH, that worked.
Offline
I'm rather confused as to why one would need to find duplicates in pacman's local installation database...
How do you have multiple versions of e2fsprogs installed at the same time???
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline