dharmik

@dharmik@linuxusers.in

admin @ linuxusers.in
student. mostly computers.

matrix@spiderham:matrix.org
codeshithttps://github.com/dhrm1k
bloghttps://dhrm1k.github.io

46 following 17 followers

4 ★ 4 ↺

dharmik »
@dharmik@linuxusers.in

TIL how to use $(command) to capture the output of one command and use it in another!

you can get the date as folder name (in format month abbreviate-date-year) with

mkdir "$(date +"%b%d%Y")"

- $(...) is used to execute the date command and substitute its output.

...
dharmik boosted

screwlisp »
@screwtape@mastodon.sdf.org

@dharmik
In the spirit of sharing
CL-USER>
(ensure-directories-exist
(format nil "~[mon~;tue~;wed~;thu~;fri~;sat~;sun~]/"
(nth-value 6 (get-decoded-time))))
"thu/"
T
CL-USER> (probe-file "thu/")
"/home/screwtape/thu/"

tl;dr a lisp form to create an abbreviated current-day-of-the-week-shortname directory by decoding the current universal-time.

...
1 ★ 0 ↺

dharmik »
@dharmik@linuxusers.in

In the spirit of sharing

the spirit of sharing is always appreciated. :)

dharmik boosted

Reid »
@Reiddragon@fedi.reimu.info

@dharmik fun fact: you can also use <(command) to take the output of command and feed it as a file argument to another command

eg. vimdiff <(command1) <(command2) (for all vim cares, those are read-only files passed as arguments)

...

Mikoto 98 SE »
@mikoto@akko.wtf

@Reiddragon @dharmik combined with tee, you could make a complex pipe network in bash

...

Reid »
@Reiddragon@fedi.reimu.info

@mikoto @dharmik shell + tee isn’t exactly my first choice for fancy pipes (anything fancier than a straight line), but yeah, you can absolutely do that

History