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"
有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top