Ravas coding goodies

For discussions about programming and projects not necessarily associated with Porteus.
donald
Full of knowledge
Full of knowledge
Posts: 2063
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Ravas coding goodies

Post#136 by donald » 01 Oct 2022, 14:58

alternatives are:

ffmpeg -i input.mp3 output.wav

lame --decode input.mp3 output.wav

btw - mpg123 does not work at all in 3.2.2-32bit because the *.la files are missing
in /usr/lib/mpg123/
extracting the slackware mpg123 package and copying the .la files made mpg123 working.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Ravas coding goodies

Post#137 by Rava » 01 Oct 2022, 15:04

donald wrote:
01 Oct 2022, 14:58
btw - mpg123 does not work at all in 3.2.2-32bit because the *.la files are missing
Thanks for the heads up on that, donald!

And thanks for the alternatives. Especially important since ffmpeg can also handle other input formats than just mp3, when lame and mpg123 only can handle mp3. (and mp2, but that one is quite rare in the wild)

Is there a way to determine if any of the three choices - lame, ffmpeg or mpg123 produces the best result?
All wav files are of course similar bad since they are based on a lossy mp3 file.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Ravas coding goodies

Post#138 by Rava » 04 Oct 2022, 20:03

Hi folks *waves*

Not something of a coding goodie, when you want one look here: [FIX] fastest-mirror & wonky network

Instead I found a Pleasant surprise in mousepad
By chance I stumbled upon the 2nd special word that gets treated by mousepad different than other words in a comment-area of code. In my case, the code is sh (bash) script code.

The first time I realized that was years ago when I realized that a

Code: Select all

# TODO Lorem Ipsum
- the TODO gets printed in bright yellow, when the rest of the comments are more or less in a subdued colour scheme.

My system XFCE 4.12 / Port 5.0 x86-64 / System Colour Scheme ("Appearance / Style") Adwaita-dark

In my pleasant for the eyes and fitting my dark theme colours scheme in mousepad is set to "Cobalt". I realized for many moons now that having TODO in a comment gets it brightly yellow highlighted.
Usually in Cobalt scheme it is a middle blue on dark blue background - not that readable per se.
But the yellow highlighted TODO stands out.

Cave! When you open a script that not ends in *.sh you have to set the file type manually via
Document > Filetype > Scripts > sh - by default mousepad would display such a script as any normal text file.


By adding some dummy entries to one of my wget.sh scripts I used XXX as placeholder … and realized XXX gets treated the same special way that TODO gets treated.

Probably a picture says more than 1000 words: therefore see the screenshot:
Image

Sadly I have no idea if these special words that get treated in that outstanding way are somewhere listed in the mousepad documentary or not…
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Ravas coding goodies

Post#139 by Rava » 05 Oct 2022, 03:22

The really nice thing about the date command is - you do not need sed or such, not even an additional echo ${date parameter} construct to get a certain needed format with extra info.

E.g.

Code: Select all

guest@porteus:~$ date +"%Y-%m-%d %H:%M"
2022-10-05 05:22
Simple enough.

But you need padding at the front and extra info at the back? Say, for logging purposes. No problemo:

Code: Select all

guest@porteus:~$ date +"                %Y-%m-%d %H:%M - script XXX.sh started"
                2022-10-05 05:22 - script XXX.sh started
Added in 6 minutes 3 seconds:
Cave!

While date +%Y-%m-%d works without quotation marks

Code: Select all

guest@porteus:~$ date +%Y-%m-%d
2022-10-05
date +%Y-%m-%d %H:%M doesn't:

Code: Select all

guest@porteus:~$ date +%Y-%m-%d %H:%M
date: extra operand ‘%H:%M’
Try 'date --help' for more information.
Therefore, it doesn't hurt to always use quotation marks since

Code: Select all

date +"%Y-%m-%d"
also works, and if you edit that line to insert more info with whitespaces, it will still work.
Cheers!
Yours Rava

User avatar
M. Eerie
Moderator
Moderator
Posts: 619
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

Ravas coding goodies

Post#140 by M. Eerie » 05 Oct 2022, 09:07

Rava wrote:
04 Oct 2022, 20:03
the TODO gets printed in bright yellow
Also valid for "FIXME" keyword.

Seems to be a syntax highlightning convention (probably included in gtksourceview)
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Ravas coding goodies

Post#141 by Rava » 05 Oct 2022, 23:23

Code: Select all

# TODO XXX FIXME 
What a weird keywords combination for now.
M. Eerie wrote:
05 Oct 2022, 09:07
Seems to be a syntax highlightning convention (probably included in gtksourceview)
Sadly, it is not that easy to track down as I hoped.

Code: Select all

root@porteus:/usr/share/gtksourceview-2.0# grep -E "TODO|XXX|FIXME" language-specs/sh.lang 
    <style id="variable"            _name="Variable"            map-to="def:type"/> <!-- FIXME: need to sort out proper styles for variables -->
root@porteus:/usr/share/gtksourceview-2.0# grep -E "TODO|XXX|FIXME" styles/cobalt.xml
  <!-- Bookmarks FIXME -->
I tried the same keywords in an HTML comment as saved by mousepad as

Code: Select all

<!-- testing TODO XXX FIXME -->
and all three get the same yellow highlighting treatment…
Cheers!
Yours Rava

User avatar
M. Eerie
Moderator
Moderator
Posts: 619
Joined: 31 Aug 2017, 21:18
Distribution: Nemesis Xfce/MATE x64

Ravas coding goodies

Post#142 by M. Eerie » 06 Oct 2022, 07:42

Rava wrote:
05 Oct 2022, 23:23
I tried the same keywords in an HTML comment as saved by mousepad as
All of them seems to intersect @ /usr/share/gtksourceview-3.0/language-specs/def.lang (in my machine).

Image
> Does not compute_ 🖖

https://forum.porteus.org/viewtopic.php?p=94310#p94310
https://forum.porteus.org/viewtopic.php?p=84002#p84002
https://forum.porteus.org/viewtopic.php?p=77174#p77174
https://forum.porteus.org/viewtopic.php?f=39&t=8584

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Ravas coding goodies

Post#143 by Rava » 06 Oct 2022, 11:04

You are right, your version gtksourceview-3.0 and mine gtksourceview-2.0 seems to only know the three keywords TODO, FIXME and XXX.
I looked for XXX only since I thought that this would hardly appear in a comment itself (like FIXME or TODO could)

Code: Select all

guest@porteus:/$ grep -A 2 XXX /usr/share/gtksourceview-2.0/language-specs/def.lang 
        <!-- Anything that needs extra attention; mostly the keywords TODO, FIXME and XXX -->
        <style id="note" _name="Note (FIXME, TODO, XXX, etc.)"/>

        <!-- Text that stands out, HTML links, e-mail addresses, etc. -->
--
                    <match>\b(FIXME|TODO|XXX)\b</match>
                </context>
            </include>
:)

Added in 23 hours 25 minutes 44 seconds:
Since I am currently either too busy with RL or too lazy to fully translate partially German commented scripts fully into English, I elaborate a bit on a code by a fellow Porteusian - babam and his getmod.
Rava wrote:
07 Oct 2022, 10:21
babam wrote:
07 Oct 2022, 08:28
You can change the ROOTDIR and WORKDIR variables in the getmod, see lines 17 and 58.
Thanks for that.

For those curious, this is line 17

Code: Select all

    ROOTDIR=/tmp/$PKG.$$
and this is line 58

Code: Select all

WORKDIR=/tmp/getmod
For those wondering, $$ is the PID (Process ID) of the current process, in this case, the one of the script.
Very handy since there is always only one program or script that uses that one PID.

Example 1:PID of shell:

Code: Select all

guest@porteus:~$ echo $$
2646
guest@porteus:~$ echo $$
2646
of course the shell doesn't change its PID since it is still the same shell.

Example 2: we create a test.sh script - by using echo in the terminal:

Code: Select all

guest@porteus:~$ echo '#!/bin/sh 
echo my PID is $$' >/tmp/test.sh
guest@porteus:~$ chmod a+x /tmp/test.sh 
guest@porteus:~$ /tmp/test.sh 
my PID is 2659
guest@porteus:~$ file /tmp/test.sh 
/tmp/test.sh: POSIX shell script, ASCII text executable
guest@porteus:~$ cat /tmp/test.sh 
#!/bin/sh
echo my PID is $$
guest@porteus:~$ 
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Ravas coding goodies

Post#144 by Ed_P » 07 Oct 2022, 14:11

Rava wrote:
07 Oct 2022, 10:29
we create a test.sh script - by using echo in the terminal:
:o :worship:
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Ravas coding goodies

Post#145 by Rava » 07 Oct 2022, 15:13

Ed_P wrote:
07 Oct 2022, 14:11
Rava wrote:
07 Oct 2022, 10:29
we create a test.sh script - by using echo in the terminal:
:o :worship:
Thanks. By doing it like this, to me it is the best and easiest way for getting people into script coding - you not even need an editor, just echo and a CLI. (Command Line Interpreter, ours is by standard bash)
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Ravas coding goodies

Post#146 by Rava » 14 Oct 2022, 02:18

Some meditations on the ls + cut hack I mentioned all over the forum already

When you only have files by root
|cut -c 19-

Code: Select all

root@porteus:~# ls -oa .bash* .xauth*|cut -c 19-
4314 2022-10-13 11:59 .bash_history
  79 2019-12-07 06:40 .bash_profile
1212 2021-01-05 14:39 .bashrc
  64 2022-10-13 07:40 .xauthBqqdsN
  64 2022-10-13 07:40 .xautho9GpXA
when you have files by guest or mixed files root/guest
|cut -c 20-

Code: Select all

root@porteus:~# touch .xauthdummy
root@porteus:~# chown guest.users .xauthdummy 
root@porteus:~# ls -oa .bash* .xauth*|cut -c 19-
 4314 2022-10-13 11:59 .bash_history
   79 2019-12-07 06:40 .bash_profile
 1212 2021-01-05 14:39 .bashrc
   64 2022-10-13 07:40 .xauthBqqdsN
    0 2022-10-14 03:48 .xauthdummy
   64 2022-10-13 07:40 .xautho9GpXA
root@porteus:~# ls -oa .bash* .xauth*|cut -c 20-
4314 2022-10-13 11:59 .bash_history
  79 2019-12-07 06:40 .bash_profile
1212 2021-01-05 14:39 .bashrc
  64 2022-10-13 07:40 .xauthBqqdsN
   0 2022-10-14 03:48 .xauthdummy
  64 2022-10-13 07:40 .xautho9GpXA
Now, even using a cut that eliminates all but the file names can make sense.

Preparations and see the full paths of the symlinks:

Code: Select all

root@porteus:~# mkdir -p /this/should/demonstrate/reallyreallylongpath/
root@porteus:~# touch /this/should/demonstrate/reallyreallylongpath/035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm
root@porteus:~# touch /this/should/demonstrate/reallyreallylongpath/001-core.xzm
root@porteus:~# mkdir base
root@porteus:~# cd base/
root@porteus:~/base# ln -s /this/should/demonstrate/reallyreallylongpath/001-core.xzm /this/should/demonstrate/reallyreallylongpath/035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm .
root@porteus:~/base# ls -o
total 0
lrwxrwxrwx 1 root  59 2022-10-14 03:52 001-core.xzm -> /this/should/demonstrate/reallyreallylongpath/001-core.xzm
lrwxrwxrwx 1 root 121 2022-10-14 03:52 035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm -> /this/should/demonstrate/reallyreallylongpath/035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm
In one of my real /base/ folders I need a ls -oh --color=always|cut -c 41- - when using it without ls -h option I would need ls -oh --color=always|cut -c 45- because there is one larger module that is no symlink.

Our demo symlinks need this: ls -o --color=always|cut -c 40-

Code: Select all

root@porteus:~/base# ls -o --color=always|cut -c 40-

001-core.xzm -> /this/should/demonstrate/reallyreallylongpath/001-core.xzm
035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm -> /this/should/demonstrate/reallyreallylongpath/035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm
Why the ls --color=always option? Because ls catches on and realizes it will be piped and therefore by default suppresses its colours output.

Let's create a non-symlink dummy file for comparison and I use [ quote ] instead of [ code ] to show the colours:
root@porteus:~/base# touch 000-kernel5.4.30.xzm
root@porteus:~/base# ls -o --color=always|cut -c 40-

000-kernel5.4.30.xzm
001-core.xzm -> /this/should/demonstrate/reallyreallylongpath/001-core.xzm
035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm -> /this/should/demonstrate/reallyreallylongpath/035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm
Now you hopefully see why a "ls -o" can at times be a good idea even when you cut off all permissions, user info and size info, because just a "ls" would not print the symlink targets, and you would also see when there is a broken symlink because ls would display it in red. So let's create a broken symlink to demonstrate:
root@porteus:~/base# rm /this/should/demonstrate/reallyreallylongpath/001-core.xzm
root@porteus:~/base# ls -o --color=always|cut -c 40-

000-kernel5.4.30.xzm
001-core.xzm -> /this/should/demonstrate/reallyreallylongpath/001-core.xzm
035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm -> /this/should/demonstrate/reallyreallylongpath/035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm
HTH…

Added in 15 minutes 31 seconds:
As comparison, a simply ls would show that there is something wrong with 001-core.xzm - but there are file types that get displayed in red. So let's simulate that as well. :D
root@porteus:~/base# touch dummy.xz
root@porteus:~/base# ls
000-kernel5.4.30.xzm
001-core.xzm
035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm
dummy.xz
by ls alone - is dummy.xz a broken symlink or is it a valid file (symlink or not) and just a compressed file?
ls -o will show us the difference between the red for 001-core.xzm and the red for dummy.xz:
root@porteus:~/base# ls -o --color=always|cut -c 40-

000-kernel5.4.30.xzm
001-core.xzm -> /this/should/demonstrate/reallyreallylongpath/001-core.xzm
035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm -> /this/should/demonstrate/reallyreallylongpath/035-fbreader-0.99.2_deps_qt-4.8.4STRIPPED+liblinebreak-2.1--x86_64.rava.xzm
dummy.xz
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Ravas coding goodies

Post#147 by Ed_P » 14 Oct 2022, 05:44

Isn't there a bash command that returns the length of a string?
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Ravas coding goodies

Post#148 by Rava » 14 Oct 2022, 06:04

^
There are several ways doing so.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Ravas coding goodies

Post#149 by Rava » 14 Oct 2022, 18:01

Let's presume you have a long info text one of your scripts should print to the terminal, and you want it nicely word wrapped and not broken by the end of $COLUMNS. This is part of my below script "sleep-timer".
Look at the lines with either

Code: Select all

MYCOL=$(tput cols)
that catches $COLUMNS or at the lines with echo " some text " at the beginning and

Code: Select all

 | fold -sw $MYCOL
at the end that does the word wrapping.

"sleep-timer" was first done via a one liner, until I got sick of that one-liner - because of how I needed editing that one-liner to alter the sleep pause accordingly to the momentarily needs (e.g. 25 minutes for rice cooking, 10 minutes for pasta and such); now in "sleep-timer" that's simply the 1st parameter.

The one liners have been e.g.

Code: Select all

tz;sleep 10m;tz;daueralarm.sh 25
when tz is a global function on my systems and daueralarm.sh is a script that sits in all my /usr/local/bin .

sleep-timer's sole dependency is another script of mine, daueralarm.sh - I already posted that here (using a more English only name since Dauer is German for "permanent" or "certain time that passes") as "sleepalarm.sh" but in my systems the script is called "daueralarm.sh"
If you want to use sleep-timer either tweak the code into it reading "sleepalarm.sh" instead of "daueralarm.sh" or create a symlink named "daueralarm.sh" that points to "sleepalarm.sh".
You first have to make "sleepalarm.sh", look above for its code, and you also need an appropriate sound file that gets your attention as a kind of alarm clock sound while not being overt annoying.

Code: Select all

#!/bin/sh
MYNAME=sleep-timer
MYVERSION=0.1  # blame Rava
#dependencies: daueralarm.sh
#function(s): tz
tz () 
{ 
    echo $(date +%d.%m.%Y\ %H:%M:%S) ____________________________________________________________
}
MYCOL=$(tput cols)
if [ $# -ne 2 ];then
	echo $MYNAME v$MYVERSION - I need exactly two parameters:
	echo "● Parameter One: The time you want me to sleep. It could be '90' - that is 90 seconds, or '4m' - that is 4 minutes etcetera. When the called command 'sleep' prints an error correct that error and try again."| fold -sw $MYCOL
	echo "● Parameter Two: The pause for daueralarm.sh in seconds - e.g. 5 or 30. When daueralarm.sh prints an error correct that and try again. In that case you would not get reminded of the sleep time being over."| fold -sw $MYCOL
	exit 1
else
	echo $MYNAME v$MYVERSION
	echo sleep time: $1
	echo pause time for daueralarm.sh: $2
	tz;sleep $1;tz;daueralarm.sh $2
fi
What I could have added it the check if the dependency "daueralarm.sh" is met, but I was too lazy doing so. It says so in its code, that's enough for now. :D

This is what it looks like in action:

Code: Select all

guest@porteus:/$ sleep-timer 5m 25
sleep-timer v0.1
sleep time: 5m
pause time for daueralarm.sh: 25
14.10.2022 17:44:16 ____________________________________________________________
14.10.2022 17:49:16 ____________________________________________________________
daueralarm.sh V1.2 - Sounddatei ist /sound/notification_-15dB.mp3
Pausenlaenge: 25 Sekunden - Abbruch mit Strg+C
^C
guest@porteus:/$ 
My daueralarm.sh speaks German, if you want to understand it run your own version of sleepalarm.sh - or ask DeepL via https://www.deepl.com/translator :)


Of course sleep-timer could be coded a bit differently:
When only one parameter is given assume that's the sleep time. And presume the user is okay with a longer pause for daueralarm.sh - 25 seconds.
When 2 parameters are given - same as above.
When none or more than 2 are given: error, only explaining that the 2nd parameter is optional, and the 1st is obligatory.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Ravas coding goodies

Post#150 by Rava » 15 Oct 2022, 03:56

The following is someone else's coding goodie; it's so brilliant I just need to share it here, so here we go:
Most of the answers above are dangerous because they do not deal with names containing odd characters. Your safest bet for this kind of thing is to use find's -print0 option, which will terminate filenames with ascii NUL instead of \n. Here I submit this script, which only alter files and not directory names so as not to confuse find.
find . -type f -print0 | xargs -0n 1 bash -c \
's=$(dirname "$0")/$(basename "$0");
d=$(dirname "$0")_$(basename "$0"); echo mv -f "$s" "$d"'

I tested it and it works with filenames containing spaces, all kinds of quotes, etc.
Source: https://stackoverflow.com/questions/152 ... e-on-linux - thanks niXar & Peter Mortensen ( the later edited it )

I added this by myself:
Cave! Only ONE directory hierarchy will be transformed from / to _ - aka the "last", rightmost one.

#d=$(dirname "$0")/$(basename "$0"|tr "[A-Z]" "[a-z]"); mv -f "$s" "$d"
You always find good stuff on the Stack Exchange network - https://stackexchange.com/ - , especially on Stack Overflow - https://stackoverflow.com/ -. :)

Added in 8 minutes 88 seconds:
I altered the above to rename some files. It would have been quicker in doing all three manually, but I wanted to work on the code and tweak it to my needs, and that is an exercise for my brain, while renaming one file at a time is hardly a mental exercise.

Here you go: First we look at the files I wanted renamed:

Code: Select all

root@porteus:/Porteus_modules# find -name 'midori-9.0*'
./midori-9.0-webkit2gtk-2.35.1-x86_64-1.xzm
./midori-9.0-x86_64-1.txt
./midori-9.0-x86_64-1.xzm
Then I tweak the above code into what I think should do the trick, but keep it as a mere echo:

Code: Select all

root@porteus:/Porteus_modules# find -name 'midori-9.0*' -print0 | xargs -0n 1 bash -c 's=$(dirname "$0")/$(basename "$0"); 
d=$(dirname "$0")/005-$(basename "$0"); echo mv -fv "$s" "$d"'
mv -fv ./midori-9.0-webkit2gtk-2.35.1-x86_64-1.xzm ./005-midori-9.0-webkit2gtk-2.35.1-x86_64-1.xzm
mv -fv ./midori-9.0-x86_64-1.txt ./005-midori-9.0-x86_64-1.txt
mv -fv ./midori-9.0-x86_64-1.xzm ./005-midori-9.0-x86_64-1.xzm
and when I am satisfied with the results echo showed me I finally execute it for real:

Code: Select all

root@porteus:/Porteus_modules# find -name 'midori-9.0*' -print0 | xargs -0n 1 bash -c 's=$(dirname "$0")/$(basename "$0"); 
d=$(dirname "$0")/005-$(basename "$0"); mv -fv "$s" "$d"'
renamed './midori-9.0-webkit2gtk-2.35.1-x86_64-1.xzm' -> './005-midori-9.0-webkit2gtk-2.35.1-x86_64-1.xzm'
renamed './midori-9.0-x86_64-1.txt' -> './005-midori-9.0-x86_64-1.txt'
renamed './midori-9.0-x86_64-1.xzm' -> './005-midori-9.0-x86_64-1.xzm'
and check the results:

Code: Select all

root@porteus:/Porteus_modules# find -name 'midori-9.0*'
root@porteus:/Porteus_modules# find -name '*midori-9.0*'
./005-midori-9.0-x86_64-1.txt
./005-midori-9.0-x86_64-1.xzm
./005-midori-9.0-webkit2gtk-2.35.1-x86_64-1.xzm
root@porteus:/Porteus_modules# 
Image
Cheers!
Yours Rava

Post Reply