I have a shell script to print appimage filenames inside a folder like this
#! /bin/bash
Dir="$HOME/Applications/"
Dir2="$HOME/Downloads/"
cd -P "$Dir"
for f in *.AppImage; do
z=$(echo $f | head -n1 | awk '{print $1;}')
echo $z
done
now the output is like this :
Altus-4.8.5-x86_64.AppImage
GitHubDesktop-linux-3.2.0-linux1.AppImage
webamp-desktop-0.3.0-x86_64.AppImage
YTDownloader.AppImage
I want the output to be like following:
Altus
GitHubDesktop-linux
webamp-desktop
YTDownloader
How can i achieve this?
webamp-desktop-0.3.0
->webamp-desktop
, that's not enough. What should happen if the input is something likethingy3-desktop-1.2.3.AppImage
?webamp-desktop-0.3.0
is two words and some numbers, then the output containing just the first word should likely be justwebamp
. Of course if looking for-0
(with any digit) works, then that's fine.