You are not logged in.
Pages: 1
Hy girls and guys,
I want to sign the keys with a bash script. Here's the code:
keys=(6AC6A4C2 824B18E8 4C7EA887 CDFD6BB0 FFF979E7)
for value in ${keys[*]}
do
pacman-key -r $value
pacman-key --edit-key $value
echo 'lsign'
echo 'y'
echo 'trust'
echo '3'
echo 'save'
echo 'q'
done.. but it stops at:
gpg> Does anybody have a solution?
Last edited by Shelly (2012-03-11 12:34:19)
Offline
Offline
As a more general comment on bash scripting, `echo` prints its parameters to stdout, this never reaches the stdin of another running process (unless redirected). In your script pacman-key is waiting for input, and until it gets it those echo lines will never execute. Even if pacman-key was backgrounded, those echos would only go to the screen, not to pacman-key.
In general you can do something like this
cat <<EOF | process-that-requires-input
lsign
y
trust
3
save
q
EOFI say in general as this should work with programs and processes that read from the standard input in 'normal' ways. I suspect, but cannot confirm, that pacman-key would fall into that category.
EDIT: there are a few different ways of redirecting blocks of 'text'. Each one has their caveats. The above is a rough example of one of them, and undoubtedly could have issues.
Last edited by Trilby (2012-03-11 12:29:34)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
That was fast. Thanks for the link and the explanation ![]()
Offline
Pages: 1