I’d much rather keep my rc organised, so I just have a pair of aliases to quickly open it in an editor and another to reload.
alias cfge="$EDITOR ~/.bashrc" alias cfgs="source ~/.bashrc"cfg…you wouldn’t happen to know anything about context free grammars, would you? i’m a linguist who specializes in syntax, so i use cfgs a lot
i have
cur() { open /Applications/Cursor.app "$@" }and then
alias cb="cur ~/.bash_rc"
And then you can immediately solve the issue with programs arbitrarily adding things to your rc file by running:
add exitprograms arbitrarily adding things to your .rc
umm why would you ever do that, i only add to my .rc when i come up with an alias i know i’m gonna use a bunch
When I’m contracting at a client sometimes they have boot strap scripts which push configuration out to your rc files that I want to gate. (Usually b/c I am using my own equipment or doing something a little strange.)
When I’m contracting, I…
uh…
dude this is just a hobby for me, I didn’t get serious about it until like a few months ago. Before that I was recovering from a traumatic brain injury, and before that I couldn’t live on my own, and right before that it was December 2014. My first programming class was back in 2005, and I went to a coding bootcamp, but I haven’t actually made an effort to get hired until my fourth manic episode in November of this year.
Sorry. I didn’t mean to offend and it’s not an attack at the project in anyway - sorry if it came across that way. I think tools to help you manage RC files are great. I just dislike tools that automatically inject themselves automatically (like rvm), my statement was in no regards about the tool you wrote.
My bad. I came across a little harsh but I was mostly just answering your question. I haven’t done the kind of things you do because I’m an amateur.
All good. Do you have a dotfiles repo somewhere?
i’ve just started learning C#, so my dotnet projects don’t exist yet
oh you said dotfiles…oh. well i dunno what that is
zshrc, bashrc, tomato, tomato, potato, potato
same shit, just replace zsh with bash. the syntaxes for the two aren’t QUITE the same but they’re so fuckin close they might as well be one language
Just different enough to break your rc files when you try to migrate :)
basically, yeah. y’all aren’t gonna believe this but i just found out the other day that you don’t need the
cdwith zsh. you can just type in the directory name. i don’t even know what else is different, i learned how to use the terminal from watching youtube linux tutorials so i might be just a lost bashbroI wouldn’t be surprised if all shells have some form of that, but not enabled by default. I know Bash does, but I’ve never turned it on.
i took the oregon trail
My version is definitely wordier, but I like it.
add-alias() { if [[ -z "$1" || -z "$2" ]]; then echo "Useage: add-alias <alias_name> \"<command_to_alias>\"" return 1 fi echo "alias $1='$2'" >> ~/.bash_aliases source ~/.bash_aliases echo "Alias '$1' for command '$2' added and sourced." }And, of course, the first thing I test it with is
$ add-alias alias-add add-alias.I have an alias called
save_aliasesthat doesalias > ~/.bash_aliases.aliason its own just dumps all the existing aliases to the terminal in a format that can be parsed by Bash.I felt especially clever when I came up with that and used it to save itself.
Bonus fact:
${BASH_ALIASES["name-here"]}is a way to get at the contents of an alias without resortingsedorcutshenanigans on the output of thealiascommand.Bonus fact:
${BASH_ALIASES["name-here"]}is a way to get at the contents of an alias without resorting sed or cut shenanigans on the output of the alias command.Doesn’t
alias name-herealready do that? That or I didn’t get what you mean.alias name-hereyields the linealias name-here='contents-of-alias-here'as output, and if you want just the part between the single quotes from that,sed,cutor, come to think of it, related shell tricks that do the same thing, would be needed to capture and convert it.${BASH_ALIASES["name-here"]}is a name for what’s only between those single quotes.For example, I have a lot of preferences built into my alias for ‘ls’. Occasionally I want to run
watch ls -l somefilespecto watch a directory listing for changes to a file. But commands fed towatchdon’t go through the alias mechanism, leaving the output somewhat different to my preferences.It’s wordy, but
watch ${BASH_ALIASES["ls"]} -l somefilespecmostly* achieves what I want.* Unfortunately,
watchalso causes the stripping of colour codes and I have--color=auto, not--color=forcein mylsalias, so it’s by no means perfect - I have add the latter if I want colour - but I don’t have to type the rest of the preferences I have in there.FWIW, my
lsalias is currently:alias ls='LC_ALL=C ls --color=auto --group-directories-first --time-style="+ %F %T"'
what i do is type out the alias and then hit enter, and then up arrow, quote, ctrl+a, add quote
I’d call it
rcappndinstead of add thoi like my variable names and aliases to sound like natural english, which means you have to conjugate the functions differently. they’re supposed to be third person singular
sorry guys i’m not a computer nerd but i’m a linguist so i like languages, including the computer ones
You must be a linguist; the only other person I’ve ever witnessed using the word “conjugate” was my mother, who taught me basically everything I know about grammar.
Have you heard of our lord and savior perl?
As a fish user i relate to this
As a fish user i relate to this
Because we fish users don’t need to write a new function for this, because we already have an option on alias for it?
In
man aliasin fish:-s or --save Saves the function created by the alias into your fish configuration directory using funcsave.In
man aliasin bash:OPTIONS
None.(PS, though, still perhaps handy, if not liking how
alias -ssaves your aliases.)







