• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics in ~comp with the tag "ask.advice". Back to normal view / Search all groups
    1. best way to go about with a script that seems to need both bash and python functionality

      Gonna try and put this into words. I am pretty familiar with bash and python. used both quite a bit and feel more or less comfortable with them. My issue is I often do a thing where if I want to...

      Gonna try and put this into words.

      I am pretty familiar with bash and python. used both quite a bit and feel more or less comfortable with them.

      My issue is I often do a thing where if I want to accomplish a task that is maybe a bit complex, I feel like I have to wind up making a script, let's call it hello_word.sh but then I also make a script called .hello_world.py

      and basically what I do is almost the first line of the bash script, I call the python script like ./hello_world.py $@ and take advtange of the argparse library in python to determine what the user wants to do amongst other tasks that are easier to do in python like for loops and etc.

      I try to do the meat of the logic in the python scripts before I write to an .env file from it and then in the bash script, I will do

      set -o allexport
      source "${DIR}"/"${ENV_FILE}"
      set +o allexport
      

      and then use the variable from that env file to do the rest of the logic in bash.

      why do I do anything in bash?

      cause I very much prefer being able to see a terminal command being executed in real-time and see what it does and be able to Ctrl+c if I see the command go awry.

      in python, you can run a command with subprocess or other similar system libraries but you can't get the output in real-time or terminate a command preemptively and I really hate that. you have to wait for the command to end to see what happened.

      But I feel like there is something obvious I am missing (like maybe bash has an argparse library I don't know about and there is some way to inject the concept of types into it) or if there is another language entirely that fits my needs?

      6 votes
    2. Thinking of getting into emacs, any advice?

      Recently I’ve been growing dissatisfied with my current workflow (Obsidian and iA) and looking to try something new, and someone recommended emacs, as long as I was up for the challenge. I figure...

      Recently I’ve been growing dissatisfied with my current workflow (Obsidian and iA) and looking to try something new, and someone recommended emacs, as long as I was up for the challenge. I figure it can’t hurt to try, and if I don’t implement it, well, I’ll have learned something.

      I’m fairly comfortable with CLIs, but will likely use a GUI, and will be using on a Mac.

      Anyone have advice for a total novice?

      17 votes