9

It's frustratingly opaque in the documentation, but you can pass a quoted shell glob to convert (quoted to prevent the shell from expanding it prematurely), and use Filename Percent Escapes to construct output filenames in the form %[filename:label] (where label is an arbitrary user-specified label), using the input basename escape %[basename] or its legacy ...


6

In a for loop it is possible to use the features described in man bash at Parameter Expansion ... ${parameter%%word} Remove matching suffix pattern. The word is expanded to produce a pattern just as in pathname expansion. If the pattern matches a trailing portion of the expanded value of parameter, then the result of the expansion ...


4

It sounds like you want crontab lines that execute a command at alternating minutes, like the first command at even minutes (0,2,4 etc.) and the second command at odd minutes (1,3,5 etc.). This can be done in the following way: 0-59/2 * * * * export DISPLAY=:0 && xset dpms force off 1-59/2 * * * * export DISPLAY=:0 && xset dpms force on ...


2

I wrote a one liner script for the startup to disable a touchpad on one of our computers. The id for the touchpad also changed every boot. xinput --disable `xinput list | grep Synaptics | awk -F'id=' '{print$2}' | awk -F' ' '{print$1}'` You can change the Synaptics to Stick and it should work


2

Can we have an official ubuntu CLI release? We have an official CLI release, it is called Ubuntu Server. Choose the manual server installation option. Here are the official instructions for installing it. What are some disadvantages of ubuntu GUI? You pointed that out in your question. What exactly is your question, then?


2

Once you run a command like sudo ./vpncmd, control doesn't return to your script until the command exits (or forks itself into the background). Only at that point do your printf commands get executed, sending their output to the terminal as usual. You can try instead something like { sleep 1 printf "2\n" sleep 1 printf "\n" sleep ...


2

You can do this with mmv (Multi-Move), so long as you install it first: sudo apt install mmv Once installed, you can do something like this: mmv DUMAK\* DUMAI\#1 That will rename all files starting with DUMAK, leaving everything afterwards and the extension untouched. If you are proficient with shell glob patterns, you can save a remarkable amount of time ...


2

calibre doesn't have man pages, if you've installed calibre v5.23.0 from their web page at https://calibre-ebook.com/download_linux. This is the recommended place to get the latest version of calibre. Note: The flatpak version v5.23.0 from https://flathub.org/apps/details/com.calibre_ebook.calibre doesn't appear to have man pages either. Note: At the https://...


1

It is not clear what your question is. I hope you don't want somebody to write the whole script but rather you ask how to get the numbers you want to work with. Use lshw, this is (redacted) output from my system, one NVMe and one SSD present $ lshw -c disk *-namespace description: NVMe namespace logical name: /dev/nvme0n1 ...


1

To "include" one script from another you should use . (dot operator) or source (depending on your shell). So you would use in Script1.sh . headerscript.sh References: https://unix.stackexchange.com/questions/309768/source-vs-why-different-behaviour https://stackoverflow.com/questions/20094271/using-dot-or-source-while-calling-another-script-what-...


1

A colleague of mine managed to find a solution to this problem. I will post it here so that I can spare others some headache :) # Remove previous MySQL versions #################################################################### export DEBIAN_FRONTEND=noninteractive sudo systemctl stop mysql sudo apt-get remove mysql-* -y sudo dpkg --configure -a sudo -E ...


1

You don't really need to use expect and can give commands to bluetoothctl directly as arguments. # ... bluetoothctl -- power on bluetoothctl -- connect $mac # ... For a more complete example, here is the full Bash script that I use in Ubuntu 20.04 for my BT radio : #!/bin/bash mac="90:03:B7:17:00:08" # DEH-4400BT if [ "$1" = "off&...


1

I use git-bash-prompt. It's configurable and easier than writing your own, which I imagine is what many readers are looking for.


Only top voted, non community-wiki answers of a minimum length are eligible