« first day (2564 days earlier)      last day (2382 days later) » 

9:26 AM
cmd_list=$(history | awk '{ print $2 }')
uniq_cmd_list=$(echo $cmd_list | xargs -n1 | sort -u)
before that I have
HISTFILE=~/.bash_history
set -o history
The issue I am facing is that if I do $echo $cmd_list, I see things like "cmd_list=$(history"
why is that appearing and how do I get rid of it?
Example: `cat cd chmod clear cmd_list=$(history echo exit gedit history ./q2.sh rm sh touch uniq_cmd_list=$(echo vi
`
The assignment question is to list the most used commands in the terminal. If you have better ways of doing it, please let me know.
 
@Yashas That's a bit difficult if you need to pick out the individual commands from compound statements like the ones you listed above.
I suppose they assume you'd be doing something like history | awk '{ print $2 }' | sort | uniq -c | sort -n
If that's for bash with the default history format.
 
I need to submit it as a bash script
I can't use the history command inside bash script directly
if I try to use some hacks, weird stuff like the one I mentioned earlier happens
 
9:41 AM
@Yashas Anything you type at the console can be put into a script.
@Yashas Then just parse the history file directly: awk '{ print $1 }' "$HISTFILE" | sort | uniq -c | sort -n
 
@Kusalananda history command inside a bash script gives nothing
 
@Yashas The code that you quoted uses history, so that's disqualified by your rules.
 
@Kusalananda Oh I'm sorry. I meant I can use any command but using history command directly in a bash script causes bugs.
0
Q: How can I use history command in a bash script?

Saleel AlmajdI try to use history command in a bash script but it didn't work. The code of the bash file: #!/bin/bash # Copy history to file history #cd /media/saleel_almajd/Study/linux/my_scripts/ echo "start Copy history to /media/saleel_almajd/Study/linux/my_scripts/history.txt" export HISTTIMEFORMA...

 
Just parse $HISTFILE then.
Or $HOME/.bash_history explicitly.
I don't really see a problem here.
 
using history after doing using set -o history makes it behave like directly reading from it
command names can contain more than alphanumeric characters, right?
so I can't do something like history | grep "\b[A-Za-z]+\b"
 
9:46 AM
See comment above about parsing the history file directly.
 
the issue is I don't want bash_script_var=$(cmd .... ) to appear in my list of commands
the bash history file has it
using history directly in the terminal doesn't show those things
 
 
7 hours later…
4:35 PM
Apple's new IOS version must tweet its location to a secret Twitter occount; we have a developer here, working on the next version of Find My iPhone:
2
Q: Counting occurrences of word in text file

MaxxxI have a text file containing tweets and I'm required to count the number of times a word is mentioned in the tweet. For example, the file contains: Apple iPhone X is going to worth a fortune The iPhone X is Apple's latest flagship iPhone. How will it pit against it's competitors? And let's sa...

 
 
1 hour later…
5:46 PM
How's everyone's update all things day going? :-/
 
@derobert Oh no.
What happens if I don't want to upgrade my phone for fear of breaking it? Ditto for routers.
 
@Kusalananda The "S" in WiFi apparently stands for the same thing as the S in IoT. At least today ☹
@FaheemMitha Errr... then your communications will be vulnerable to intercept?
You could of course run some other security layer. E.g., most smartphones can run OpenVPN.
 
@derobert That's not particularly helpful.
I want to move to a different, nicer, planet.
Does anyone have suggestions?
@derobert Did you just reply to a message from January?
 
@FaheemMitha yep :-D
@FaheemMitha Could try Mars, probably no WiFi hackers there. Though I'm not sure if Trump currently plans to go there—could ruin the neighborhood if he does.
 
Weird, I'm watching an Israeli romantic comedy TV series. I didn't even know Israel did romantic comedy.
@derobert The lack of atmosphere, and pretty much everything else, might be a minor hindrance.
If Trump went there, he would die of asphyxiation.
 
5:57 PM
@FaheemMitha au contraire! The lack of atmosphere will make the signal reach further. And no rain fade!
(No idea what dust storms will do to it, though)
 
@derobert Also, lack of electricity.
 
@FaheemMitha You can burn all the hydrocarbons you want without having to worry about global warming.
 
@derobert You seem to have it all figured out.
 
@FaheemMitha Well, you never know when someone is going to start a nuclear war on Twitter. Important to be prepared. ☺
 
I've been trying to get my phone to stop upgrading to the next version of Android (Marshmallow) for fear of breaking it.
@derobert Agreed.
 
6:03 PM
Anyway, you real option is to run some other encryption layer on top of WiFi — OpenVPN has been easy since Android ICS, and IPSec has been there even before that.
Of course, if you've been avoiding a Marshmallow update... you've probably got so many other vulnerabilities that you'd be carefully repairing dings in the paint job on the Titanic.
 
@derobert I'm not sure what you mean.
@derobert That makes me feel much better.
 
@FaheemMitha You can run a VPN and configure that phone to send all traffic over that. Then you no longer need WPA2's security guarantees.
 
@derobert Sounds complicated. And possibly unreliable. Do you do that?
 
I used to, before WPA2 existed. (Well, it was from a laptop back then—this was before smartphones existed). That was IPSec, which is definitely more complicated than OpenVPN. OpenVPN is fairly easy.
 
You should also remember that depending on application, there might also be another level of encryption on transport layer (TLS, for example when accessing websites over https)
 
6:33 PM
@derobert Been given some new tasks at work updating bioinformatics databases. So I've been updating those. The WiFi issue is not interesting to me (not using Wifi much, except for the phone).
AFAIK, the WiFi issue, from reading the OpenBSD mailing lists, was not that the encryption was weak, but that more or less all implementations of it were buggy. Memory was not cleared properly, or something.
 
Nearly all implementations buggy due to the spec being buggy, apparently.
 
The encryption in WPA2 in apparently strong.
@derobert Yes.
 
But thankfully in a way that's fixable w/o breaking compatibility.
 
I've had a couple of days off from U&L (due to too much work). Any interesting questions/answers popping up?
 
@Kusalananda check this out ;-)
but nothing particularly remarkable IMO
 

« first day (2564 days earlier)      last day (2382 days later) »