jutty, to programming
@jutty@bsd.cafe avatar

After a while trying to understand if either ksh or zsh provided a way to prevent taking strings and undefined variables as 0 when doing arithmetic evaluation, there seems to be no feature specifically for it, sadly.

Closest is using set -o nounset (ksh) and setopt no_unset (zsh) to prevent undefined variables from evaluating to zero. If a "string" contains only numbers, a dot and whitespace, it will be treated as a number. Also, if it only contains the name of any other variable and whitespace, it evaluates to that.

Not that I expected shell languages to provide accurate arithmetic.

As a bonus though, it was cool learning about ksh's compound variables, force_float option and especially discipline functions.

juandesant, (edited ) to random
@juandesant@astrodon.social avatar

A one-liner for exporting your Conda environments for re-creation on another machine… but you might want to have a look at whether you actually need to recreate those environments.

for envs in $(conda env list | egrep -v "^#" | awk '{print $1}'); do echo "Exporting environment: $envs"; conda activate $envs; conda env export --no-builds | egrep -v "^prefix" > "$envs.yaml"; conda deactivate $envs; done; ls -l *.yaml  

/ht @boitarsor for improvement

mindaslab, to mathematics
@mindaslab@mstdn.social avatar
pbarker, to opensource
@pbarker@social.afront.org avatar

Bash/zsh tip: ! is a valid character in an alias. I use it to mark aliases which run under sudo, for example on my Debian box I have:

alias e!="sudo ${EDITOR}"
alias a!="sudo apt"
alias s!="sudo systemctl"
alias in!="sudo apt install"

... and a few others.

gregorni, to programming
@gregorni@fosstodon.org avatar

What does your development environment look like right now?

(IDE/Text Editor? Terminal Multiplexer? Package Manager? Shell? Programming Language? Containerization? Command Runner? Terminal Emulator?)

blainsmith,
@blainsmith@fosstodon.org avatar

@gregorni

Editor:
Terminal emulator: terminal
Terminal multiplexer:
Shell:
Linux Desktop: @system76 !
Langs:
DB:
Containerization:
SCM:

fabian, (edited ) to programming
@fabian@floss.social avatar

For all you fancy command line prompt-havers. Newline or no newline at the end of the prompt?

So, this:

you@host ~/f/bar git:main [*?]␤  
> ▁  

Or this:

user@host ~/f/bar git:main [*?] > ▁  

bryan, to linux

I wish you could create aliases that were specific to a directory. Like a little bash aliases file that stayed and only worked in one directory.

infektor,
@infektor@mastodon.gamedev.place avatar

@bryan https://github.com/Tarrasch/zsh-autoenv is a plugin but it sounds like what you want. I reimplemented it slightly differently in my own config https://code.infektor.net/config/zsh/src/branch/master/autoenv without too much effort. Not sure if bash has similar change directory hooks though.

santiago, to random
@santiago@masto.lema.org avatar

Also a bit lost regarding some path issues on . To use my usual scripts, I installed zsh + ohmyzsh andI symlinked
~/config/settings/.zshrc
to ~/.zshrc

Everything seems to work but python stuff only works properly in bash.

In zsh pip says:
/bin/python3.10: can't open file '/boot/home/pip'

(the last thing being any path I am currently in). PATH is the same so it must be some Python env variable ?

santiago,
@santiago@masto.lema.org avatar

Well.. this fixes it for pip …but not for packages installed by it (for example compiledb).

They are installed in :
/packages/python3.10-3.10.13-3/.self/non-packaged/bin

So I add can this path (which will inevitably change) to my .zshrc but why the hell doest it works with bash without anything in PATH or any other env variable ?

leftpaddotpy, to postgres
@leftpaddotpy@hachyderm.io avatar

good evening! do you use software of any description? ? ?

have you found the manuals annoying and hard to find things in, or telling you to go f-- err i mean read the info page?

consider using the single page builds of such reference manuals on https://docs.jade.fyi

they have nice CSS and no page splitting so you can simply hit ctrl f

b0rk, (edited ) to random
@b0rk@jvns.ca avatar

if you have your current git branch in your shell prompt, what do you use to set it up?

so far I know about

mjgardner, (edited )
@mjgardner@social.sdf.org avatar
mjgardner,
@mjgardner@social.sdf.org avatar

@zekjur @b0rk It looks like you use , so you would be well-served by ’s Instant Prompt feature that gives you a prompt while it’s updating status information in the background: https://GitHub.com/romkatv/powerlevel10k#instant-prompt

philsplace, to random
@philsplace@mastodon.sdf.org avatar

Been programming the same languages for the last 20+ years and still have a hard time remembering which is ‘elsif’, ‘else if’ and ‘elseif’.

That is Perl, Javascript and SQL.

Every day* I mess one of them up.

*like just now

mjgardner,
@mjgardner@social.sdf.org avatar

@philsplace And you still left out the elif in -compatible like , , and

nurkiewicz, to random
@nurkiewicz@fosstodon.org avatar

So I'm using on top of on top of (with plugins) on top of . At this point I have no idea which terminal features come from which software. And if I really need all of these installed

ellie, to Bash
@ellie@hachyderm.io avatar

Atuin v18 is out now!

Sync and search encrypted shell history across multiple machines

https://blog.atuin.sh/release-v18/

There's a lot in this one, but some highlights

  1. Command inspector
  2. Xonsh support
  3. Vim keybindings
  4. Sync v2 (opt-in)

Thank you so much to everyone who contributed to this release!

@atuin

pixel, to random
@pixel@social.pixels.pizza avatar
thomy2000, to rust
@thomy2000@fosstodon.org avatar

It's crazy what you can do with tab completions these days. I don't really know about this behavior though...

deepthaw, to FreeBSD
@deepthaw@social.sdf.org avatar

As I juggle both a Linux and FreeBSD server - is there a real good reason to pick one shell vs others? They naively seem similarly capable, and it's more a matter of just picking one with good tutorials and running with it? I'm hardly a shell-scripting wizzard.

matthew,
@matthew@social.retroedge.tech avatar

I'm trying ZSH, as it seems a bit more in line with the Unix way of thinking and is MIT licensed.

Bash is just there on most of the servers I manage and I haven't yet changed it.

mtekman, to Bash

I've wasted literal years dabbling in beautiful looking shells ( / ), or trying to enhance my with needlessly bloated decoration frameworks (oh-my-bash/starship), I've decided to roll my own bash prompt in 20 lines.

It shows everything I need: user and host only over ssh, active environments (, venv, or ), and the branch if I'm in a project.

That's it. Runs quick and easy.

Just add the code (see the alt/hover text in the code image) to your , and voila!

[function prompt_command { ## styles and symbols local RESET='[\033[0m]' ; local BLD_GRN='[\033[1;32m]'; local BLD_YLW='[\033[1;33m]'; local BLD_PPL='[\033[1;35m]'; local BLD_WHT='[\033[1;37m]'; local ITL_YLW='[\0333;33m]'; local LSEP='{'; local RSEP='}'; local MSEP='|' ## export PS1="" ## Prepend contexts local GIT_BRANCH=$(git branch --show-current 2>/dev/null) [ -n "$SSH_CONNECTION" ] && PS1=${PS1}${BLD_WHT}'\u'${ITL_YLW}'@'${BLD_PPL}'\h'${RESET} [ -n "$CONDA_DEFAULT_ENV" ] && PS1=${PS1}${LSEP}${ITL_YLW}${CONDA_DEFAULT_ENV}${RESET}${RSEP} [ -n "$VIRTUAL_ENV" ] && PS1=${PS1}${LSEP}${BLD_WHT}${VIRTUAL_ENV##*/}${RESET}${RSEP} [ -n "$GUIX_ENVIRONMENT" ] && PS1=${PS1}${LSEP}${BLD_GRN}'GUIX'${RESET}${RSEP} [ -n "$GIT_BRANCH" ] && PS1=${PS1}${LSEP}${BLD_PPL}${GIT_BRANCH}${RESET}${RSEP} ## Truncate the path local trunc_len=25 ## shorten dirs if less than this local short_dir=$(pwd | sed -r "s|^${HOME}|~|") [[ ${#short_dir} > $trunc_len ]] && short_dir=$(sed -r 's|([^/]{2})[^/]+/|\1/|g' <<< "${short_dir}") ## Merge separators, and add the truncated path PS1=${PS1//${RSEP}${LSEP}/${MSEP}} PS1=${PS1}${BLD_GRN}${short_dir}${BLD_YLW}'▶ '${RESET} } export PROMPT_COMMAND=prompt_command

santiago, to random
@santiago@masto.lema.org avatar

TIL that for some reason unlike on Linux, FreeBSD, and even Haiku a session on Mac doesn’t setup the path automatically when you execute a command on start.

So if you want to launch tmux on Mac from ssh you must source your profile first like this (otherwise it won’t find tmux in the homebrew path):

ssh user@192.168.0.33 'source ~/.zshrc; tmux new-session -A -s "SessionName" '

tsdh, to emacs
@tsdh@emacs.ch avatar

It has been long on my todo list but finally I've tried out the terminal emulator for and it's brilliant! I didn't try it earlier because the homepage only mentions shell integration with and but it works nicely with , too. One thing I can't get working is directory tracking. I think I configured my prompt that it emits OSC 7 shell escapes (but how would I know for sure? They're invisible!). Doesn't eat recognize them, @akib?

gnulinux, to Bash German
@gnulinux@social.anoxinon.de avatar

Welche Terminal-Shell soll ich nutzen?

Terminal ist nicht gleich Terminal. Wie bei vielem hat die Anwenderin eine grosse Auswahl. Im Titelbild seht ihr einen Funktionsvergleich der häufigsten Linux Shells.

https://gnulinux.ch/welche-terminal-shell-soll-ich-nutzen

kunev, to random

Question for any people, especially ones using the fast-syntax-highlighting plugin:

I recently figured out that plugin also colorizes a bunch of commands, among them is . Now, I've wrapped git in a thin script called g, which without arguments starts , or if given any arguments just passes them on to git.

I want to get fast-syntax-highlighting to work with my g command as well. It literally needs to treat it just the way it does git. I tried the stupidest thing i could thing of, which was to copy -git.chroma into -g.chroma (why with the dash... my goodness...) and just change the relevant occurrences of git with g, renaming functions and variables too so they don't somehow end up clashing with the ones for git. It achieved nothing.

Anyone ever actually added custom highlighting to fast-syntax-highlight in a similar way?

There's an open (unanswered) issues about aliases, but this doesn't fit into that case exactly since here g is a separate script, not just a shell alias for git.

jamiefdhurst, to Bash

Whenever I need to create a quick script (and I can't easily do it in or ) without tests and for ease, I'll typically use . I've spotted others doing the same in , , etc. Does everyone go back to the language they're most familiar with in these scenarios?

ellie, to Bash
@ellie@hachyderm.io avatar

My top shell commands from 2023!

I ran out of energy to keep my neovim config properly up to date, so opted for LunarVim. It's been fantastic so far

nixCraft, to linux
@nixCraft@mastodon.social avatar
mjgardner,
@mjgardner@social.sdf.org avatar

@BrownianMotion @nixCraft Because you might be on or another distro with an older version but want to use a newer one yourself. On the you could install the newer one with @homebrew, add its path to /etc/shells, then set your account’s default shell to it. Or do the same with which has been the default for the past few major releases.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • anitta
  • kavyap
  • everett
  • thenastyranch
  • magazineikmin
  • ngwrru68w68
  • DreamBathrooms
  • modclub
  • Youngstown
  • slotface
  • PowerRangers
  • osvaldo12
  • InstantRegret
  • rosin
  • Leos
  • hgfsjryuu7
  • Durango
  • vwfavf
  • khanakhh
  • tester
  • GTA5RPClips
  • ethstaker
  • mdbf
  • cubers
  • tacticalgear
  • normalnudes
  • cisconetworking
  • provamag3
  • All magazines