filename can be changed as alias

You can change space in terms of network size and time in terms of cron sceduling

as

@ +*/ Crontime

piping a path should autodetect / as its function without providing the flag

and a string as + function

but doesnt seem to be currently working to detect, maybe me

maybe it now always needs a cron which would be a pain

but yes, manipulates space/structure and time in 1 command

as soon as i debug core,,,

nah, permisssion denied on ./@, something is off

but frontend exists , backend needs a debug, it speaks uwu

and breaks your mind to comprehend

i like it<3

like if you color the printed log list by how often a adress is used ,

, , i nini now..~

#!/bin/bash

# Define the script path (adjust to your script's actual path, uwu)
SCRIPT_PATH="/path/to/@" 

# Display the cuwwent contents of destinations.txt at the stawt, uwu
echo "Cuwwent contents of destinations.txt, uwu:"
cat destinations.txt
echo "-------------------------------------"

# Dispway usage exampwes and expwain featuwes, uwu
print_usage() {
    echo "Usage: ./@ <operator> [\"<cron time>\" | <path> | <text>], uwu"
    echo "Opewatows, Usage, and Exampwes, uwu:"
    echo "  + : Add a singwe wine. Echo text and pipe into scwipt, uwu."
    echo "      Exampwe: echo 'New wine' | ./@ + \"* * * * *\""
    echo "  - : Wemove wines containing text. Echo text to wemove and pipe, uwu."
    echo "      Exampwe: echo 'Wemove this wine' | ./@ - \"* * * * *\""
    echo "  * : Wemove wines matching piped text fwom 'destinations.txt', uwu."
    echo "      Exampwe: cat wines_to_wemove.txt | ./@ * \"* * * * *\""
    echo "  / : Add wines fwom a piped fiwe path to 'destinations.txt', uwu."
    echo "      Exampwe: echo '/path/to/additionaw_wines.txt' | ./@ / \"* * * * *\""
    echo "Cwon Scheduwing awong with wine modifications, uwu."
}

# Ensure an opewatow is pwovided
if [[ $# -lt 2 ]]; then
    print_usage
    exit 1
fi

operator=$1
cron_schedule=$2
shift 2  # Pwepawe additional arguments fow use

# Validate the opewatow
if ! [[ "$operator" =~ ^[\+\-\*/]$ ]]; then
    echo "Invawid opewatow: $operator, uwu"
    print_usage
    exit 1
fi

# Wead piped input if pwesent, othewwise set to empty, uwu
piped_input=$(cat)

# Function to update cwon job fow this scwipt, uwu
schedule_with_cron() {
    (crontab -l 2>/dev/null | grep -v "$SCRIPT_PATH"; echo "$cron_schedule $SCRIPT_PATH $operator") | crontab -
    echo "Scwipt scheduled with cwon: $cron_schedule, uwu"
}

# Main wogic fow opewatow actions
case $operator in
    +)
        content="${@:-$piped_input}"
        echo "$content" >> destinations.txt
        ;;
    -)
        content="${@:-$piped_input}"
        sed -i "/$content/d" destinations.txt
        ;;
    \*)
        [[ -n "$piped_input" ]] && echo "$piped_input" > /tmp/@_temp.txt || touch /tmp/@_temp.txt
        while IFS= read -r line; do sed -i "/$line/d" destinations.txt; done < /tmp/@_temp.txt
        rm /tmp/@_temp.txt
        ;;
    /)
        [[ -n "$piped_input" ]] && { echo "$piped_input" >> destinations.txt; } || echo "No piped content weceived, uwu."
        ;;
esac

# Scheduwe with cwon if a scheduwe is pwovided, uwu
[[ -n "$cron_schedule" ]] && schedule_with_cron

# Dispway the updated contents of destinations.txt, uwu
echo "Updated contents of destinations.txt, uwu:"
cat destinations.txt
echo "-------------------------------------"

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *