Untitled

 avatar
unknown
plain_text
a month ago
1.0 kB
20
Indexable

create_task_list() {
    if [[ ! -f task_list.txt ]]; then
        touch task_list.txt
        echo "Task list created."
    else
        echo "Task list already exists."
        echo "Current tasks:"
        read_tasks
    fi

    read -p "Enter a task to add to the list: " task
    echo "$task" >> task_list.txt
    echo "Task added: $task"
}
read_tasks() {

    if [[ -f task_list.txt ]]; then
        echo "Current tasks:"e
        cat task_list.txt
    else
        echo "No tasks found. Please create a task list first."
    fi
}

while true; do
    echo "Movie Night Task List"
    echo "1. Create Task List"
    echo "2. Read Tasks"
    echo "3. Add Task"
    echo "4. Exit"
    read -p "Enter your choice: " choice

    case $choice in
        1)
            create_task_list
            ;;
        2)
            read_tasks
            ;;
        3)
            echo "Exiting..."
            exit 0
            ;;
        *)
            echo "Invalid choice. Please try again."
            ;;
    esac
done
Editor is loading...
Leave a Comment