#!/bin/bash
# Prompt the user for the journal entry
echo "Enter your journal entry:"
read entry
# Append the entry to the journal-file
echo "$(date "+%Y-%m-%d %H:%M:%S"): $entry" >> ~/journal-file
echo "Journal entry added successfully!"
The following shell script adds entries to a file named journal-file in your home directory.
1 answer