You are not logged in.

#1 2022-12-30 13:38:17

lawaniya
Member
Registered: 2022-06-09
Posts: 2

[user error] Issue with pacman-key if used in script.

Executing below code results in

#!/bin/bash

export DEBUG_OFF='/dev/null'

pacman-key --init  &> $DEBUG_OFF && echo $? || echo $?
pacman-key  --populate archlinux &> $DEBUG_OFF && echo $? || echo $?
0
1

while executing the commands individually leads to success.

How can I make the script succeed, gives error that dev/null.gpg does not exist?

EDIT: Error due to double quoting and not using quotes.

Last edited by lawaniya (2022-12-30 17:26:50)

Offline

#2 2022-12-30 13:50:18

seth
Member
Registered: 2012-09-03
Posts: 38,676

Re: [user error] Issue with pacman-key if used in script.

"error that dev/null.gpg does not exist?"

export DEBUG_OFF='/dev/null'
pacman-key --init  && echo $? || echo $?
pacman-key --populate archlinux && echo $? || echo $?
pacman-key --init  &> /dev/null && echo $? || echo $?
pacman-key --populate archlinux &> /dev/null && echo $? || echo $?

And post the actual I/O, https://bbs.archlinux.org/viewtopic.php?id=57855

Online

Board footer

Powered by FluxBB