-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
last: invalid option -- '-' #6
Comments
+1 |
👍
|
Exact same issue. It's possible to replace "--time-format" by "-t" but an error with time format appears. |
We can fix this by editing 2 lines in the original motd.sh script.
This is based on http://pastebin.com/g0CrwQ7j, which I got from here: https://www.domoticz.com/forum/viewtopic.php?f=23&t=6738 |
Not solved this problem. After login I says "Last Login....: None " |
Is it the same problem or a new one? If it's different create a new issue On Nov 23, 2016 2:59 PM, "kszere" [email protected] wrote:
|
To fix this, I did a probably crap workaround, but seems to work for me. Distributor ID: Raspbian Linux MyServer 4.4.32-v7+ #924 SMP Tue Nov 15 18:11:28 GMT 2016 armv7l GNU/Linux 106 # TTY login The above I commented out the old section and just creted everything from 120 to 124. Hopefully this is readable. |
I am still having this issue on my install of the script. I can't find any form of "last" that has the --time-format flag at all. So I am not sure where that came from honestly. |
I fixed it here: lines 113 and 123. https://gist.github.com/vidia/5d760a27cec2b9bd318dcc5c636c5a1d#file-motd-sh-L113 |
@vidia Thanks for the fix, but I had to make one more change before it worked for me. On line 122 from your link above, the IF statement is looking for a "T" in the $loginDate string and on my Raspberry Pi that doesn't exist, so I changed if [[ $loginDate == T ]]; to if [[ $loginDate != T ]];. Now it works. |
Don't use my fix listed above, It has issues on some days of the week. There may be better ways to fix it, but for now I just changed it to $loginDate == * instead of $loginDate == T. This is more of a hack, but I think it will be okay for now. if [[ $loginDate == * ]]; then |
reading through the errors, i realized that this is the same issue as #8 and that the fix is the same: (fix copied from other issue) the issue for this is that the "--time-format" switch is not supported on this version of the date command for whatever reason. the work around i cobbled together involves line 100: original code: modified (and added line) code: the key difference is that it changes the date to display the full date with the -F switch, and pulls all of the individual date elements followed up by the next command to join all of the different strings into the ISO formatted string that the later code (if [[ $loginDate == T ]]; then...), that particular if is looking for the "T" that is present in an iso formatted timestamp which was originally designed to come from the "--time-format iso" portion. |
Getting the above error on:
Linux raspberrypi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l GNU/Linux
The text was updated successfully, but these errors were encountered: