This helps distinguish commands that find
runs from its own arguments. Imagine how find
would figure out which commands it's executing, and what their arguments are. The easiest way to do this is to use the standard end-of-command character. That way, you don't need to create a special way to separate things. You can even put one find
command inside another.
DollyDuller
find /your/mp3/directory -type f -name "*.mp3" -exec test -f "/your/mp3/directory/$(basename -s .mp3 {}).txt" \; -exec mp3splt -A "/your/mp3/directory/$(basename -s .mp3 {}).txt" {} \;
This one liner should still work, even if your file names have spaces in them because find
now looks at each individual match, not the entire output. Using a for loop with the results of find
would create a lot of extra pieces of the file names because spaces separate the arguments. However, this single command is harder to read than using a for loop.
The idea behind this one is that search operators in find
evaluate to true or false. The first exec
tells find
to run the second exec
only if the file exists. If the file doesn't exist, it just ignores it.
Watching this video brought back memories of when I first started using Linux. I really connected with him. Linux makes you feel like you have a lot of control – like you can change things easily. Windows, on the other hand, often feels frustrating and doesn't really help you much.
What I noticed about the video is that he encourages you to try new things and be willing to make mistakes. He doesn't seem to get upset when things go wrong, which I think is helpful for viewers. He also admits that Linux isn't for everyone, which is a realistic acknowledgement. It's a good video for introducing Linux, but it doesn't overhype it either.
I'm not entirely sure how it works, but I think it's read from top to bottom. If you need to control the order of execution, I'd suggest writing shell scripts and adding them to the config file. It should make things easier to manage.
First, make sure to include the full path to the script in your config file, like exec /home/your_username/path/start_cmus.sh
or exec ~/path/start_cmus.sh
. If you just use ./start_cmus.sh
, there will be a complaint as it doesn't know where to look for the script.
Another thing to keep in mind is that swaymsg
is usually the better choice (man sway
) when you want to send commands to sway. You can write your script as swaymsg -t command 'workspace 10; exec wezterm -e cmus'
and then put the whole thing in your config file.
To make debugging easier, I like to add some echo
or notify-send
commands to my script to see if it's working as expected. I'll put those in my config file, run it, and check if the debug commands are being executed correctly like echo "first: $first_output" && commands && echo "second: $second_output"
. It's a simple trick that can save you a lot of time. Also, don't forget to check out journalctl
for more info.
F5panic
This isn't an echo chamber. You and I are on Lemmy, and we, lemmings, love free and open-source software. But I bet you that many people still use proprietary software as their daily drivers. Many of them still use Windows as their main OS, and many are still on iOS. However, that's not the end of the story. They also use plenty of FOSS software, like Firefox, VLC (you can't deny the love of people for VLC), OBS, and qBittorrent. And that's a good thing! It's not a binary choice that you have to either go this way or this way. That's not healthy.
Even if this is an echo chamber, so what? I see it as an effort to set a norm for the community. 'Hey, I love Linux, you should try it!' 'I have the same experience, you should give it a go.' 'I've used Linux for a long time and I love it, feel free to ask me any questions.' When there are many people willing to help, others are less scared to try new things. And when we move together, we fear nothing!
Do you like hurting other people?
You're correct about command substitutions, the
$(...)
part. I had initially thought putting it inside ash
would be clearer and avoid problems with substitutions. However,$0
is the name of the shell or the script. To fix this, we can put{}
inside a variable, like this:file="{}"
. Then, we can use the variable$file
for the rest of the command.I also think using
for
loops makes the command easier to read. But dealing with files that have spaces in their names can be really frustrating when you usefor
loops.