Useful function for bash
Clone this repository in your home directory.
Copy/paste the code below in your ~/.bashrc
, for scanning the ~./bash_functions
directory
# Import ~/.bash_functions
functions_directory=~/.bash_functions
_import_recursively() {
local path=$1
local ignore_files=(
"README.md"
"LICENSE"
"Scripts"
)
if [ -d "$path" ]; then
# Check if the directory name is in the ignore list
local dirname=$(basename "$path")
#echo "DEBUG - Dirname: $dirname"
if [[ " ${ignore_files[@]} " =~ " $dirname " ]]; then
return # Ignore the directory
fi
# Recursively explore the contents of the directory
for i in "$path/"*; do
_import_recursively "$i"
done
elif [ -f "$path" ]; then
local filename=$(basename "$i")
# Check if the file is not in the ignore list
if [[ ! " ${ignore_files[@]} " =~ " $filename " ]]; then
#echo "DEBUG - File to include: $path"
source $path
fi
fi
}
if [ -d ~/.bash_functions ]; then
_import_recursively "$functions_directory"
PATH=$PATH:$functions_directory/Scripts
fi
Wrapper of official command flatpak list
, show the flatpak applications and allow to perform sorting for sigle column.
Example:
flatpak-list --sort=size
- (good first issue) Improve this README file
- (good first issue) Add --app as optional parameter
- multi-columns sorting
- issues with review of code, are welcome