Skip to content

Instantly share code, notes, and snippets.

View naranyala's full-sized avatar
🎯
F11 - back to the context

FMH (@gema_naranyala) naranyala

🎯
F11 - back to the context
View GitHub Profile
#!/bin/bash
# Check if the zip file argument is provided
if [ -z "$1" ]; then
echo "Please provide the path to the zip file as the first argument."
exit 1
fi
# Verify if the zip file exists
zip_file="$1"
#!/bin/bash
# Check if the RAR file argument is provided
if [ -z "$1" ]; then
echo "Please provide the path to the RAR file as the first argument."
exit 1
fi
# Verify if the RAR file exists
rar_file="$1"
#!/bin/bash
# Verify if the directory argument is provided
if [ -z "$1" ]; then
echo "Please provide the path to the directory you want to compress as the first argument."
exit 1
fi
# Verify if the directory exists
directory="$1"
#!/bin/bash
# Verify if the directory argument is provided
if [ -z "$1" ]; then
echo "Please provide the path to the directory you want to compress as the first argument."
exit 1
fi
# Verify if the directory exists
directory="$1"
#!/bin/bash
# Check if the 7z file argument is provided
if [ -z "$1" ]; then
echo "Please provide the path to the 7z file as the first argument."
exit 1
fi
# Verify if the 7z file exists
archive="$1"
@naranyala
naranyala / dirfile-create-open.sh
Last active August 8, 2023 03:10
this script simplify `mkdir` and `touch` and have clear state when create and removing file or directory
#!/bin/bash
# Function to print usage information
print_usage() {
echo "Usage: $0 [-O|--open] <file_path>"
}
# Check if an argument was provided
if [ $# -eq 0 ]; then
print_usage
@naranyala
naranyala / dirfile-trash-delete.sh
Last active August 8, 2023 03:10
this script can delete directory or file that utilize `trash-cli` capabalities to move into "trash", this script also has confirmation prompt to delete and clear message state
#!/bin/bash
# Function to print usage information
print_usage() {
echo "Usage: $0 <file_path>"
}
# Check if an argument was provided
if [ $# -eq 0 ]; then
print_usage
@naranyala
naranyala / show-textfile-bat-glow.sh
Last active August 8, 2023 03:09
respect rendered markdown in terminal
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Error: No filename provided. Usage: $0 <filename>"
exit 1
fi
filename="$1"
if [ ! -e "$filename" ]; then
@naranyala
naranyala / search-into-browser.sh
Last active August 8, 2023 03:09
direct search from terminal (cli) into default browser | desktop and mobile (termux)
#!/bin/bash
# Function to handle errors and exit the script
function handle_error {
echo "Error: $1"
exit 1
}
# Associative array to store website URLs
declare -A websites
@naranyala
naranyala / show-metadata-exiftool.sh
Last active August 8, 2023 03:09
display file metadata. including text file, image, audio, and video.
#!/bin/bash
# Function to display metadata for a given file
show_metadata() {
if [[ -f "$1" ]]; then
echo "File: $1"
exiftool "$1"
echo "---------------------------------------------"
else
echo "Error: File '$1' not found or not a regular file."