Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion bash_project/.bash_profile
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
# your solution here...
#!/bin/bash

# Greet the user
echo "Hello $USER"

# Define environment variable
export COURSE_ID="DevOpsBootcampElevation"

# Check .token file permissions
token_file="$HOME/.token"

if [ -e "$token_file" ]; then
token_permissions=$(stat -c %a "$token_file")
if [ "$token_permissions" != "600" ]; then
echo "Warning: .token file has too open permissions"
fi
fi

# Set umask
umask 0006

# Add directory to PATH
export PATH="$PATH:/home/$USER/usercommands"

# Print current date in ISO 8601 format
echo "Date: $(date -u +"%Y-%m-%dT%H:%M:%S%z")"

# Define command alias
alias ltxt='ls *.txt'

# Create ~/tmp directory if it doesn't exist, and clean it if it does
tmp_dir=~/tmp
if [ ! -d "$tmp_dir" ]; then
mkdir "$tmp_dir"
else
rm -rf "$tmp_dir"/*
fi

# Kill process bound to port 8080 if it exists
process_id=$(lsof -i :8080 -t)
if [ -n "$process_id" ]; then
kill "$process_id"
fi

# Additional configs
summary = "*Script by Ibraheem G."
echo "$summary"