The following shell script adds entries to a file named journal-file in your home directory. This script helps you keep track of phone conversations and meetings.



$ cat journal

# journal: add journal entries to the file

#!/bin/bash

# Check if the journal file exists, if not create it
if [ ! -f ~/journal-file ]; then
touch ~/journal-file
fi

# Get current date and time
current_date=$(date +"%Y-%m-%d")
current_time=$(date +"%H:%M")

# Prompt the user to enter the type of entry
read -p "Enter the type of entry (phone or meeting): " entry_type

# Prompt the user to enter the details of the entry
read -p "Enter the details of the entry: " entry_details

# Write the entry to the journal file
echo "$current_date $current_time - $entry_type: $entry_details" >> ~/journal-file

# Print a success message
echo "Entry added successfully."