I added the below code to empty ~/.bash_profile file and after restarting and login via ssh to the server I get syntax error: unexpected end of file .bash_profile
NODE_ENV=production
if [ -f ~/.bashrc ]; then . ~/.bashrc fi
I am trying to create a countdown - most likely the hard way. I have it setup like this:
#! /bin/bash
#When to execute command
execute=$(date +"%T" -d "22:30:00")
#Current time
time=$(date +"%T")
#Subtract one from the other.... the below is line 11
math=$(("$execute"-"$time"))
#Repeat until time is 22:30:00
until [ "$math" == "00:00:00" ]; do
echo "Countdown is stopping in $math"
sleep 1
clear
done
The problem is.... It isn’t working. Here’s the output in the terminal:
/path/to/file/test.sh: line 11: 22:30:00-16:39:22: syntax error in expression (error token is “:30:00-16:39:22”)
Countdown is stopping in
Firstly, the error message, what’s wrong?
Secondly, the “Countdown is stopping in” message should have the hours, minutes, and seconds that the countdown will stop in. Why doesn’t it? Keep in mind I am not a professional.
Ubuntu 18.04.4 (automatic upgrade from 18.04.3 just a few weeks ago)
/bin/bash
After I log in from the Gnome shell, this message appears while the screen is just plain purple and before the desktop appears:
Error found when loading /home/hfinger/.profile:
/home/hfinger/.profile: line 1: #: command not found
/home/hfinger/.bashrc: line 1: syntax error near unexpected token '('
/home/hfinger/.bashrc: line 1: '# ~/.bashrc: executed by bash(1) for non-login shells.'
As a result the session will not be configured correctly.
You should fix the problem as soon as feasible.
Trouble is, what is the problem? I have searched AskUbuntu but no-one appears to have experienced this exact problem. I don't think it is the upgrade because it had been running for about a month before this problem appeared.
I have never touched these two files because I am quite happy to let the system create and configure them. Also, I try to keep Ubuntu as vanilla as possible to avoid having to restore settings after upgrading to a new release. For what it is worth, here are the first lines of each of these files:
.profile, line 1: # ~/.profile: executed by the command interpreter for login shells.
.bashrc, line 1: # ~/.bashrc: executed by bash(1) for non-login shells.
How do I need to fix these files? What additional information should I provide so that someone more knowledgeable than I can solve this dopey problem?
For instance, the following command does not work:
if [[-e xyz]]; then echo File exists;fi
ksh gives the following error
[[-e: command not found
Is that because "[[-" is ambiguous?
Today I opened gnome-terminal
and I wrote
ls && sleep 4 && gnome-terminal
to open another terminal after the completion of ls
command and waiting for 4 seconds.
So it successfully opened a new terminal after previous commands completely ran (including sleep 4
).
After that, next time I typed a new command
ls -lR && sleep 4 && gnome-terminal
The command ls -lR
completed after 3 seconds, but after that none of the commands sleep 4
and gnome-terminal
ran successfully.
What is the problem?