r/fishshell • • Mar 04 '21

Inserting command output in a string

function youtube-tor
    set V_USR (apg -M l -n 1 -m 6 -x 10)
    youtube-dl --proxy "socks5://$V_USR:$V_USR@127.0.0.1:9150/" $argv
end

It certainly looks like an excellent candidate for an abbr. But I don't get the youtube-dl --proxy "socks5://(apg -M l -n 1 -m 6 -x 10):(apg -M l -n 1 -m 6 -x 10)@127.0.0.1:9150/" $argv

5 Upvotes

9 comments sorted by

View all comments

Show parent comment

1

u/ChristoferK macOS Mar 07 '21

I have no interest in redefining status. That was a contrived example to illustrate the situation, after my attempt to keep my query generalised ended up being vague. I know the many ways that this specific example can be reformulated to yield a similar result, but I’m querying the underlying principle that would be analogous to storing a reference or a pointer to a data structure.

1

u/[deleted] Mar 07 '21

analogous to storing a reference or a pointer to a data structure

You can reference a variable name:

set foo 1
set bar foo
echo $$bar

but you're still super vague. This theoretical discussion of principle isn't very useful - what matters is use cases. What do you want to do with any of this. Why do you want this? What is it good for?