Domanda

So what I'm intending to do here is to create a part of a script that can open a single or multiple torrents with µtorrent (through wine).

The Wine path needs to be appended to the arguments like so (the loop is obviously not working):

for i in "$@"; do
  open="Z:/$(pwd)/$i"
done

wine utorrent "$open"
È stato utile?

Soluzione

I would use an array:

args=()
pwd=$(pwd)
for i; do
    args+=("z:/$pwd/$i")
done
wine utorrent "${args[@]}"

In a bash for loop, if you leave out the in ... clause, it iterates over "$@" by default.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top