Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Alexander Skwar
@alexs77_gitlab
=> export AWS_ACCESS_KEY_ID="$2" AWS_SECRET_ACCESS_KEY="$4" AWS_SESSION_TOKEN
Fabian Homborg
@faho
Yes?
In that while-loop, do set -gx AWS_ACCESS_KEY_ID $cred; set -gx $AWS_SECRET_ACCESS_KEY $whatever?
Alexander Skwar
@alexs77_gitlab
fish often is quite a bit more complex then bash, isn't it?
Fabian Homborg
@faho
It's a different model
Alexander Skwar
@alexs77_gitlab
yep
Fabian Homborg
@faho
And plenty of things are built with bash assumptions in mind, so the rickety whitespace splitting is assumed
But the thing to do isn't to translate line-by-line, it's to think about what you want to do and translate that.
In this case, you want to extract "fields" from a line and put them into variables.
Which means you want read.
Which doesn't work for bash because of scoping, and also because its read has a number of footguns.
Alexander Skwar
@alexs77_gitlab

thanks, you're right. read might be better.

In bash, I'll probably do now:

read x AWS_ACCESS_KEY_ID x AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN <<< $(aws sts assume-role --role-arn "$arn" --role-session-name "foo" --output text | sed 1d)
export AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN

And in fish:

aws sts assume-role --role-arn "$arn" --role-session-name "switchedrole" --output text | sed 1d | read -x x AWS_ACCESS_KEY_ID x AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
Alexander Skwar
@alexs77_gitlab
thanks, @faho , this looks better - for both shells.
Fabian Homborg
@faho
Be careful with bash's read.
In particular you most likely want read -r.
Alexander Skwar
@alexs77_gitlab
Thanks, I changed the script to use read -r instead :-)
enzotib
@enzotib
read vars < <(process) is better than read vars <<< $(process)
Alexander Skwar
@alexs77_gitlab
you're right as well
enzotib
@enzotib
someone says me that fish reads .fishrc, is that true?
Fabian Homborg
@faho
@enzotib No.
Fish reads config.fish
fishrc is not, nor has it ever been, a thing.
enzotib
@enzotib
ok, thank you
Fabian Homborg
@faho
The person who told you that probably just assumed fish must be just like the other shells.
There's bashrc and zshrc, so there must be fishrc.
enzotib
@enzotib
he said that he put an export command into it, and he said it worked
Fabian Homborg
@faho
It did not.
Fish does not read fishrc. Either he's fumbled the test or is actively bullshitting you.
You could also just search the code for "fishrc" and see that you come up empty.
Of course it is possible that some third-party thing adds a "fishrc" - that's as simple as adding source ~/.fishrc to one of the files it does read.
But it's not a stock thing, it has never been and it won't be in future.
Because the "rc" convention of naming files is a weird anachronism.
enzotib
@enzotib
I have no problem to believe it
Johannes Altmanninger
@krobelus
What's the policy when completions generated from a man page are basically equivalent to a hand-written one in share/completions? Do we delete the latter?
Fabian Homborg
@faho
@krobelus Personally I wouldn't, as long as the completions are correct.
There's no guarantee the man page on the system is good, or that python is installed.
We don't need to save on number of files.
Johannes Altmanninger
@krobelus
@faho ok, I just found an outdated one for wc
Fabian Homborg
@faho
"outdated" often just means it was written for the lowest common denominator.
Johannes Altmanninger
@krobelus
ohh i see
Aaron Gyes
@floam
many of our completions are out of date. Want to submit a PR to add any important options?
Fabian Homborg
@faho
Usually that means it doesn't have GNU features.
Aaron Gyes
@floam
or that.
Johannes Altmanninger
@krobelus

our completions for wc includes options like -cwhich is POSIX and --bytes which is probably a GNU extension
and --files0-from was missing but it's definitely not important

anyway, makes me wonder whether it would make sense to let some generated completions take precedence over shipped ones
only for those where we can assume that the system's man page is accurate

probably not feasible :(
Aaron Gyes
@floam
for a number of utilities like this we do detect if we've got the GNU tool or a BSD one and adjust the completions appropriately
Aaron Gyes
@floam
I'll try to fix it.
Aaron Gyes
@floam