Bash

892 readers
1 users here now

Talk about the Bash Shell and Bash scripting

founded 5 years ago
MODERATORS
26
2
Using at command (lemmy.one)
submitted 2 years ago* (last edited 2 years ago) by sin_free_for_00_days@lemmy.one to c/bash@lemmy.ml
 
 

A lot of people haven't heard of the at command, and I just figured I'd post up a little bit about it. I use it as a semi-alarm clock type reminder.

Structure of command the way I use it:

echo "notify-send -u critical -t 0 'YOUR URGENT MESSAGE'" | at "2pm Jun 18"

I actually wrote a tiny function so that I don't have to remember the -u critical -t 0 part. That is to keep the notification box from timing out. Now tomorrow (June 18th) at 2pm, a message box will pop up with the text "YOUR URGENT MESSAGE".

There are options for running commands (like cron, but you don't have to edit, then delete your edit after running). It is great if you don't want to mess with cron, or another utility for a quick reminder.

My quick little function looks like this:

notify_me ()
{
    if [[ $# -ne 2 ]]; then
        echo 'Usage:  notify_me "message" time/date' 1>&2;
        echo '                   make sure to enclose message in quotes' 1>&2;
        echo "                   also enclose date if it's more than just a time" 1>&2;
        return;
    fi;
    echo "notify-send -u critical -t 0 '$1'" | at "$2"
}

So say I have to remind myself to call the wife when the work day is over. I'll do something like:

notify_me "Check with the ol' ball and chain" "4:45pm"

I'm sure if you wanted to, you could make a very quick zenity (or whatever you like) gui for it, if that's the way you roll. Now I'll get a nice little pop-up 15 minutes before I check out. Tiny little things like this are why I enjoy the command line so much.

For more uses, check out the man page, or the tldr. It's not complicated and I find it useful.

27
28
 
 

Since the DNS lapsed for the wiki, someone grabbed a copy and put it up on github.

There is also the original webserver IP for /etc/hosts use, as the server is still there.

29
1
submitted 2 years ago* (last edited 2 years ago) by Plasma@lemmy.ml to c/bash@lemmy.ml
 
 

It's basically a builtin that you compile that can interface with routines in shared libraries, which means you could make GTK programs, network stacks, and more, all with bash and no external tools!

30
31
1
submitted 4 years ago* (last edited 4 years ago) by rmc0@lemmy.ml to c/bash@lemmy.ml
 
 

HI,

I don't use bar and status, only WM and some apps, so I use PS1 for see clock and battery status, clock change each time I enter a new prompt line but status battery change only with new shell

example :

PS1="$(cat /sys/class/power_supply/BAT0/capacity)% \A"

thanks

32
3
submitted 4 years ago* (last edited 4 years ago) by leanleft@lemmy.ml to c/bash@lemmy.ml
 
 

linux terminal

33
7
submitted 4 years ago* (last edited 4 years ago) by leanleft@lemmy.ml to c/bash@lemmy.ml
 
 

"We want to document one-liners for frequent (non-trivial) tasks executed in the shell"

34
 
 

linux shell manpage help

35
1
submitted 4 years ago* (last edited 4 years ago) by creativeBoarClimate@lemmy.ml to c/bash@lemmy.ml
 
 

I wasn't easily able to find a command line study timer so I made one.

I'm not a great programmer so I was wondering if I could get some feedback. Cheers!

36
 
 

A Static Site Generator Made by Taminaru in Bash!

The current features are:

  • Creating and editing posts in Markdown.

  • Using templates, variables.

  • Configuration, both local and universal (explained in README)

It's around 80% complete, so any contribution is appreciated (i would help if i wasn't lazy af lul).

Anyway here's the source code: https://codeberg.org/taminaru/BSG