« first day (2590 days earlier)      last day (2375 days later) » 
00:00 - 19:0019:00 - 00:00

jrg
12:00 AM
@NathanOsman yeah i know
@AndroidDev normally that's because you're in the mount point
 
@jrg lol, facepalm
 
jrg
@AndroidDev cd to another directly not on the mount point and try to unmount it again
 
@AndroidDev did you manage to add the rules to user.rules and userv6.rules?
ok
 
I just turned off the firewall. I'll fix it once I'm back in the instance
 
jrg
(Anyone in Grand Rapids MI? I'll be there this weekend, if you're around on Friday or Sunday I'd love to grab coffee and a photo)
 
12:08 AM
Sorry im to far of off that :)
 
jesus
everything is down
 
well the chat here works so it is not everything ;)
 
Slack m80o
 
is this NAA?
 
jrg
12:28 AM
they can't comment (1 rep)
 
so naa then
 
jrg
If I move the post and child comments to the parent post though
they won't be able to reply
(or at least they shouldn't be able to)
 
ah ok
well i flagged it as naa so untill this gets reviewed they still can communicate
as well i wonder why so many ubuntu-phnoe questions are flagged as cant be reproduced? is ubuntu-phone no longer a thing?
 
jrg
12:47 AM
I don't know what to do about the phone :(
 
just tell me is this a thing or did that die out, when its a dead project then we can safely assume that there wont come any questions anymore and the posts can be closed, i skipped those questions in review for now
to be honest most of those questions werent great and had equally bad and vague answers
well im done with close vote que for today
 
 
1 hour later…
2:03 AM
@Mateo with the last commit, shareboxes have returned to NitroShare.
They are implemented as a plugin now and it's still very basic. But it will be easy to add new features now.
 
2:39 AM
any idea how i can make a bash script found out if its run as sudo or not?
 
@Videonauth sudo sets the SUDO_USER environment variable to the username of the user who ran sudo, and this variable should otherwise be unset (or at least empty), so it is common to check that. But do you really want to find out if sudo is being used? Or do you want the script to check if it is running as the root user?
 
well i try to make my sources script more versatile and since it is writng to /etc/apt/sources.list it should run as sudo at least
 
What do you mean by "run as sudo"?
Do you mean run as root?
 
sudo script-name
 
That run script-name as root, since sudo runs its command as root unless another user was specified with the -u option.
 
2:51 AM
#!/bin/bash
DIST=$(sed -n 's/DISTRIB_CODENAME=//p' /etc/lsb-release)
FILE="sources.list"
{
echo "deb http://archive.ubuntu.com/ubuntu $DIST main restricted universe multiverse";
echo "deb-src http://archive.ubuntu.com/ubuntu $DIST main restricted universe multiverse";
echo "deb http://archive.ubuntu.com/ubuntu $DIST-updates main restricted universe multiverse";
echo "deb-src http://archive.ubuntu.com/ubuntu $DIST-updates main restricted universe multiverse";
echo "deb http://archive.ubuntu.com/ubuntu $DIST-backports main restricted universe multiverse";
actually im writing not to the final file
want to be able later to simply git clone all the scripts to a new ubuntu installation regardless of what distro it is and run this to edit the sources.list
so either being root as running it or sudo run it
jus to make it nicer it should exit with a message instead of error cant write to
 
You just want the script to check if it has root privileges and exit immediately with a friendly error message if it does not?
 
exactly
 
54
Q: How can a script check if it's being run as root?

MalabarbaI'm writing a simple bash script, but I need it to check whether it's being run as root or not. I know there's probably a very simple way to do that, but I have no idea how. Just to be clear: What's a simple way to write a script foo.sh, so that the command ./foo.sh outputs 0, and the command su...

 
ah good that will do
 
@Videonauth Btw I suggest using a here document instead of echo commands grouped with { } because the syntax is simpler.
#!/bin/bash

DIST=$(sed -n 's/DISTRIB_CODENAME=//p' /etc/lsb-release)

cat >sources.list <<EOF
deb archive.ubuntu.com/ubuntu $DIST main restricted universe multiverse
deb-src archive.ubuntu.com/ubuntu $DIST main restricted universe multiverse
deb archive.ubuntu.com/ubuntu $DIST-updates main restricted universe multiverse
deb-src archive.ubuntu.com/ubuntu $DIST-updates main restricted universe multiverse
deb archive.ubuntu.com/ubuntu $DIST-backports main restricted universe multiverse
 
3:04 AM
that dont work, the strings inside the lines dont get expanded that way
 
They do.
Try it.
(I did just check.)
 
this is waht i had before and it didnt
weird
maybe because i used $1 and $2 before ?
 
Well, I don't know what you had before exactly, but to control whether or not expansions are performed in the text of the here document, you quote any part (or all) of EOF in <<EOF to prevent expansions, or quote no part of it to allow expansions.
 
before i did make-sources artful <filename>
and used inside the script $1 and $2
 
(This is not specific to the word EOF, you can use whatever word you like and the rule about quoting controlling whether or not expansions happen is the same.)
 
3:06 AM
like i said on my side it didnt expand the strings and this is why i changed to echo
 
Can I see the full script you used before?
 
i changed it around
 
If you don't have it then I guess I don't know what to tell you, but parameter expansion in here documents works, is heavily relied on, is officially documented, and I did test that script before pasting it in here.
 
dang i not have git yet setup on that project, want to compile a set of scripts so that i just git clone them into a new installation, esepecially because i set up a lot of VMs lately
well ill try it and make this time a second script to test on
 
Hiya folks, I'd like to run a question by you before I ask it to make sure it's not stupid
Google is turning up nothing
I upgraded to 17.10 today, which means the indicator applet tray in the lower left went away (I've been using Gnome for a few months prior)
My problem is that programs that would put an indicator there are retaining their old behavior of not truly exiting (just closing the window) when I attempt to close them
Normally I would remove them from the indicator applet tray after that, but, well, it's gone
And so I have 3 or 4 programs that, according to system monitor, stick around in my RAM well after every sign of their existence that I can find is long gone
I suppose this makes my question: how do I close them?
Ideally more gracefully than constantly killing stuff
 
3:15 AM
use the Topicons plus extension or the ubuntu-appindicator extension
the latter should be preinstalled
i presonally use topicons plus
 
Oh, forgot to mention my googling did turn that up
and it gives me some unhelpful error when i try to enable it
 
What error?
 
the ubuntu-appindicator, that is
it literally just says "Error"
and I don't know where to look for a more detailed message
 
Oh.
 
turn up a terminal and tell us what echo $XDG_SESSION_TYPE returns
 
3:17 AM
x11
 
mhmmm ok so running on Xorg
 
Oh hey that was easy
 
@EliahKagan youre right now te expansion of the strings works
 
A few of them are missing but I suspect those are ones I've already killed
An afternoon of Googling and you guys @Videonauth fixed it in 5 minutes lol
Thanks!
 
I just broke the gnome shell in my testing period so many times that i remember the things i have run into :)
 
3:20 AM
@John That was totally @Videonauth. I had no idea how to solve that.
 
you might want to keep this extension enabled some programms only turn up in this
 
Do we have a question on the site for this? If not, one of you could post a self-answered question or something. It would probably help others. @Videonauth do you happen to know?
 
@Videonauth Oh yeah I plan to keep this enabled
I actually liked the tray
 
@EliahKagan i think we have a question for this and this is even mentioned there
 
@Videonauth Was the problem before that you hadn't passed arguments in for $1 and $2 or something?
 
3:22 AM
i passed arguments
 
I even came and searched this site specifically before asking in here :|
 
but they didn't expand only showed up as $2 in the resulting file
 
@Videonauth Hmm. But you don't have the original script that mysteriously didn't work? And no part of EOF (or whatever word you used) was quoted? (I consider this an interesting puzzle, but obviously you need not continue to try to figure it out unless you are also curious.)
 
┌─[04:14:24]─[michael@NEXUS-ONE]
└──> testing $ cat make-sources-list-1
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
DIST=$(sed -n 's/DISTRIB_CODENAME=//p' /etc/lsb-release)
FILE="sources.list"
cat > $FILE << EOF
deb http://archive.ubuntu.com/ubuntu $DIST main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu $DIST main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu $DIST-updates main restricted universe multiverse
this works now but shellcheck keeps nagging about double quotes for the strings
 
That's the script that does work, right?
 
3:25 AM
yep
in my sript before i did double quote enclose the EOF
 
What command (approximately) had you used to run the old script that hadn't worked? And was the here document inside a shell function? (Shell functions set the positional parameters from $1 on--but not the special $0 parameter--to their own arguments.)
@Videonauth Oh. That's the reason then.
Any form of quoting on any part of the word is sufficient to suppress all expansions of text inside the here document.
 
ah ok good to know
now only one thing is missing to make this script complete, a check if /etc/lsb-release exists and ask if not for a distro name
 
From 3.6.6. Here Documents (let's see if I can get the formatting right on this lol):
No I cannot. (Sorry.)
 
just in cae, even if i not have seen a missing lsb-release file
oh ok but that bash documentation is old, backticks should be avoided
but i got what it said
 
@Videonauth The documentation doesn't say to use backticks. I just can't format it properly for this dialect of Markdown.
 
3:30 AM
first i wanted to make it a python script, but then this would mean to import os and make a ton of subprocess calls which is not neccesary
if [ -e /etc/lsb-release ]; then
 
If you can view images, here's the relevant part (but the whole section is not that long so you can just look to that):
@Videonauth Are there Debian derivatives that do not have /etc/lsb-release?
Most GNU/Linux OSes (though not all) have an lsb_release command even if they don't have /etc/lsb-release.
 
dunno, i just make the script check, better safe than sorry
┌─[04:35:13]─[michael@NEXUS-ONE]
└──> testing $ lsb_release
No LSB modules are available.
┌─[04:35:18]─[michael@NEXUS-ONE]
└──> testing $ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.10
DISTRIB_CODENAME=artful
DISTRIB_DESCRIPTION="Ubuntu 17.10"
 
$ lsb_release -c
Codename:       xenial
 
mhmmm
 
$ lsb_release -c | grep -oE '\w+$'
xenial
 
3:38 AM
well we talk especially ubuntu, the sources.list file is set for archive.ubuntu.com
until now i never encountered a ubuntu release without the lsb-release file in etc
 
Yeah, so you can really assume the file is there. I mean, I don't think there's really anything wrong with checking for it first, but it might be better to check if $DIST is empty after has been assigned, because that will catch problems from a file that exists but doesn't have the needed entry, too.
 
true
 
Yeah all Ubuntu releases have /etc/lsb-release. I'm only suggesting the lsb_release command because you were concerned about whether or not the file would be there.
 
yes im concerned it would leave maybe someone with a malformed sources.list file in the end if i where to share the script
if its only me using it fine, i know how to repair the file in any case
well i can check for the file there, anf if not i can use lsb command to extraxt the data and if $DIST is stil empty i can read it from user input
 
Yeah, I would check that $DIST is nonempty, then, since that's more robust and covers the case where the file doesn't exist, too.
Are you checking it in case the user is running the script on some OS that might not have the file?
(It's not the only file that your script relies on existing.)
 
3:43 AM
you never know what people do with scripts they found on github :)
 
@Videonauth Shellcheck is nagging about double quotes for the ocurrences of $DIST in the here document?
 
now it is not wonder why
thats my script now
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
if [ -e /etc/lsb-release ]; then
DIST=$(sed -n 's/DISTRIB_CODENAME=//p' /etc/lsb-release)
else
DIST=$(lsb_release -c | grep -oE '\w+$')
fi
if [[ $DIST -eq "" ]];then
read "Enter your distribution name: " -p DIST
else
FILE="sources.list"
cat > $FILE << EOF
deb http://archive.ubuntu.com/ubuntu $DIST main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu $DIST main restricted universe multiverse
now the only chance to produce and error is having a distro without the command lsb_release
-eq is hopefully right for equal
and shellchecks only nagging point is this
In make-sources-list line 12:
read "Enter your distribution codename: " -p DIST
^-- SC2162: read without -r will mangle backslashes.
 
-eq is arithmetic equality. You want = to compare text (the [[ facility in bash also supports == and treats it the same as =).
 
ah ok
 
Yeah always use -r unless you can explain why you want backslash sequences to be interpreted. I've never encountered a situation where omitting -r with read would actually do what I wanted.
But you may want to use the unary -z test instead.
 
3:55 AM
if [[ $DIST == "" ]];then
read "Enter your distribution codename: " -pr DIST
 
That's definitely fine, or you can use [ -z "$DIST" ] or [[ -z "$DIST" ]] or [[ -z $DIST ]] (but not [ -z $DIST ] because with [ word splitting will be performed on $DIST).
 
yeah i see makes even more sense
 
As far as I know there is never an OS that has /etc/lsb-release but no lsb_release command, so unless you're trying to cover the case where the user's path is messed up and doesn't allow commands to be run (in which case you should cover that for sed, grep, and cat too), I don't think there's really any benefit to checking for that file. It only exists as a way to implement the lsb_release command.
 
well now this script is versatile, before i had to change the codename of the dist every time i have run my script by hand
now i end up with a perfectly clean and ordered sources.list file
 
I doubt this matters but since you're interested in versatility... should the script be able to run on Unix-like operating systems that aren't GNU/Linux? If so, note that even when bash is installed on many such system, it is not always /bin/bash.
 
4:04 AM
its the question where to end with versatility, if i would like to cover all possibilities i would have to take into account how the sources file for debian look like, that arch has an complete other approach on how to file mirrorslists and so on
 
As far as I know, no system has lsb_release without /bin/bash (because "LSB" is "Linux Standard Base"), but since you're handling the situation where the user has to manually enter the codename, it occurs to me that you might want people to be able to run the script from other OSes too where bash may be /usr/local/bin/bash or whatnot.
 
probably would have to revert back to using sh instead of bash
because sh is always in /bin/sh
 
@Videonauth Oh. Well I'm not thinking that you ought to change what output is produced. I'm thinking of the case where one runs the script on one system to produce files to use on another. The script creates sources.list in the current directory rather than immediately attempting to write it out as /etc/apt/sources.list, right?
 
no at the end it is writing directly over /etc/apt/sources.list
 
Oh.
 
4:06 AM
i just changed so i can test without messing up
 
So, do you even actually want it to do that when /etc/lsb-release doesn't work or lsb_release doesn't produce usable output?
If either that file or that command is broken, presumably the user will not actually want to proceed to overwrite /etc/apt/sources.list, will they?
 
no but i think as long it comes to ubuntu i should have covered all cases
not really
 
Well on a working Ubuntu system you always have /etc/lsb-release with the necessary entries, and you always have a working lsb_release command.
 
yep and even if the user manages to delete the lsb-release file the script should work
 
Of course, I'm sort of speaking circularly here -- if you didn't have those things, I wouldn't consider it a working Ubuntu system -- but I mean, if you don't have them, proceeding (at least without a warning) seems more like a bug than a feature.
Well I guess you have a point though in trying to work without it.
 
4:09 AM
true
well before writing i could give a summary and ask yes or no to proceed
 
Because maybe they have deleted that file (so lsb_release won't work either, as it reads from it on Debian and Ubuntu, so they'll have to manually enter the release name) and they are going to reinstall a package to replace it, but they need to fix their sources.list to do that.
Well, do you think users might want to use the script noninteractively?
It's your script and this is subjective, but personally I'd allow the user to pass the codename as an argument to the script.
 
in the case theyre changing a system file, and essential one too when it comes to updates so i think a prompt for proceeding is not bad
 
If they haven't and it can't find the codename, it could fail, but give an error message saying how to specify the codename manually.
 
humm this i had before
wellas of now the script tries to estimate the codename and if it fails it asks
wonder whats more convenient
 
Before you had it take the codename as a command-line argument but inspect /etc/lsb-release if the argument wasn't passed?
 
4:13 AM
no just took command line argument and producing
not asking not verifying nothing
 
I might have just bricked a router :(
 
and before that i had a static script simply producing not even changing the codename, i had to do afterwards by hand
 
I wrote a file to /jffs and rebooted, and it didn't come back
I don't suppose anybody else has an RT-N66U and has experienced this?
Well in any case if I did brick it it's a soft brick
 
sorry fritz-box user here and i doubt my ISP would be happy with me meddeling with their router
 
Hahaha, I have full telnet into mine
Why the heck they chose telnet instead of SSH, I do not know
 
4:17 AM
well i could enable it there plenty of tutorials out there for this, but well it is patched for KRACKattac adn i have no reason to mess it up
 
I could install a 3rd party firmware with SSH support
 
only weak spot on my home netwrk is in fact my mobile phone now
which has not been patched yet
 
I haven't physically tried unplugging it and plugging it back in, but when it didn't come back I just decide to stop my project for tonight
 
finally back after 5 hours of no internet. thanks comcast.
 
yeah i would say so too, with your luck today you are setting your house ablaze as next
 
4:19 AM
I had to manually write a file with the certificate password for the VPN to the router's internal flash
 
@AndroidDev are you using dd-wrt?
@AndroidDev I wish..
 
@Seth I'm using the stock firmware which is based on it
 
ah. Did you format jffs first?
 
No, there was already stuff in it, such as the .ovpn file I uploaded through the GUI. But the way I setup the VPN it requires a password to decrypt the private key, and the GUI doesn't have a field for that. So I edited the .ovpn file with askpass parameter and pointed it to a new file I created on jffs with the password
But after rebooting, the Wifi SSID never came back, and I decided to call it quits for today
If nothing else, I may have found a bug
@Seth is the 3rd party dd-wrt patched against KRACK? I'm disappointed Asus hasn't patched the official firmware yet
 
@AndroidDev it was patched day of iirc, but I'm not sure the latest build has made it down to all the builds yet.
You'd have to check
 
4:28 AM
@Videonauth Well if you make it obtain it automatically when it's run with no arguments, then if that fails it can tell the user to run it with the desired codename as an argument, then that's almost as easy as being prompted (or easier, depending on the user and their use case).
It seems to me that this is also in line with your approach of quitting when it doesn't have root privileges. You don't have the script run sudo when the user didn't, so why have the script automatically prompt the user for the codename?
 
well i now implemented a confirmation dialog
 
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
if [ -e /etc/lsb-release ]; then
DIST=$(sed -n 's/DISTRIB_CODENAME=//p' /etc/lsb-release)
else
DIST=$(lsb_release -c | grep -oE '\w+$')
fi
if [[ -z $DIST ]];then
read "Enter your distribution codename: " -pr DIST
else
echo "Your distribution codename is: $DIST"
read "Do you want to proceed and write to $FILE (y/n)" -pr CONFIRM
if [[ $CONFIRM == "n" ]];then
echo "Aborted."
exit 1
elif [[ $CONFIRM == "y" ]];then
 
Does this command actually work?
read "Enter your distribution codename: " -pr DIST
 
i will find out now
 
4:30 AM
Shouldn't the prompt come right after -p? (That command does not work for me.)
 
-p is for prompt
mhmmmmm
I'll test
 
Yeah, but I think it will use r as the prompt and fail because it thinks the string is intended as a variable name. (And when I test it, that does happen.)
$ read "Enter your distribution codename: " -pr DIST
bash: read: `Enter your distribution codename: ': not a valid identifier
It's odd Shellcheck doesn't detect that; it should be able to notice that an invalid variable name is being used with a shell builtin that expects a valid one.
 
@EliahKagan read -rp "what" DIST
and yes odd that shellcheck does not catch this
 
Yeah, it works with p at the end of a word and the prompt string as the next word.
Btw, when you paste multiple lines of code into chat, there's a "fixed font" button that you can use to make it display correctly (it indents every line by four spaces automatically so that the Markdown processor formats it as code).
The "fixed font" button appears to the right of the "send" and "upload..." buttons. I was going to ask "Are you really not intending anything in the script for if and else?" but I realize you're just not using the "fixed font" button when you post the messages. :)
 
4:39 AM
What's supposed to happen when the user types something in other than y or n?
 
so turned all the read around now this should work, now i just need to test if the single lines work, for that i think i would have to use a VM so i can realyl go mad and delete lsb-release file and even lsb_release for testing
he actually ends up doing nothing but i could put in another else statement as default
 
Well you can also -- at least during initial testing -- test a version of the script that is the same except with /etc/lsb-release deliberately misspelled to force it to fall back.
 
stating that he has to enter either y or n and then abort message
or that
 
Well you could probably just check for y, proceed if that's what they entered, and cancel on anything else.
 
i actually check on n and exit, then check on y and write, and if the input is garbage nothing happens
it just ends the script
had to move the variable FILE up to the top of the script, another error shellcheck did not catch
 
4:43 AM
So, do you actually need it to have both code that checks the /etc/lsb-release file and code that runs the lsb_release -c command? Either one is enough in Ubuntu, and running the command should always be enough because the command is the more general approach (there are other distros that don't have /etc/lsb-release but still have that command, implemented differently but still supporting -c)?
 
the question is, does it hurt now that it is implemented this way?
sure i could take a few if out and fi
 
If you do want to do both of those things, then you might want to make the parsing logic work more similarly for both. With lsb-release -c, it actually checks that the entry for the codename looks reasonable; specifically, it checks that it's a single word (i.e., a contiguous sequence of alphanumeric characters or underscores) at the very end of the line.
But when it reads /etc/lsb-release, it takes whatever is to the right of DISTRIB_CODENAME= (and the logic to check if the variable is nonempty won't detect nonsensical stuff that can't be a codename and would break sources.list with weird inscrutable errors, which I suppose could happen if the file is corrupted or the entry is empty or something as a result of not being populated correctly in a bad install).
 
so turning it around maybe ?
checkign first for lsb_release
 
Well I don't think it matters that much which you check first. Both will work unless something is weirdly wrong on the user's system, and in that case, you probably want it as robust as is reasonable. It seems to me that the current code is actually less robust than if you removed the branch that checks for and examines /etc/lsb-release because no checking is done to make sure that the value extracted from it is usable (except to check that the value is non-empty).
But you certainly don't have to remove that branch to fix that. You could just implement a more robust check (or extract the substring using a method that incorporates the check, as you are currently doing in the command that parses the output of lsb_release -c).
 
wow i didnt know that i have the power to delete files which belong to root in my home folder
 
4:53 AM
Yeah, the power to rename and delete files is conferred by having write permissions on the directory, unless the sticky bit (restricted deletion bit) is set on the directory, and even in that case the owner of the directory is not specially restricted.
 
but how would you check if the result is nonsense or not?
 
Well lsb_release -c | grep -oE '\w+$' only matches one or more word character. That at least prevents whitespace and punctuation other than _ from being included. Presumably release codenames will always be made of only alphanumeric characters or underscores (just because they will presumably always be alphanumeric--I don't think there's any special reason to think that if a punctuation character were included that it would be the underscore).
You could get more conservative with it and allow only lower-case letters, if you wanted. But certainly I don't see any benefit to allowing whitespace or arbitrary punctuation, since those are what's most liable to yield weird errors that the user won't be able to figure out easily if they make their way into /etc/apt/sources.list.
 
btw pycharm with its bash plugin catches more errors as shellcheck
 
Which errors did it catch that Shellcheck missed?
 
simple variable use
 
4:59 AM
Simple variable use?
 
if [[$CONFIRM == "y" ]] should be [[ $(CONFIRM) == "y" ]] or at least it is what it suggests
im not firm enough in bash to confirm that
 
What?
$( ) is command substitution.
Does it say that or ${CONFIRM}?
$( ) doesn't expand variables, it would run CONFIRM as a command and substitute the output.
 
ah right {} not ()
 
Oh. Well...
If it is saying that you should always use ${CONFIRM} over $CONFIRM, then it my opinion, that's garbage advice.
The simple form of parameter expansion exists for a reason and is neither deprecated nor generally frowned upon.
 
ah ok so i simply ignore it, i just loaded it into pycharm becasue its easier editing in there
especially i wanted to indent the code
 
5:04 AM
You can probably configure it to suppress that specific type of warning if you decide you don't want it, while still emitting other warnings.
 
and doing that in nano is PITA
well in fact codename was in all ubuntus i saw till now always [a-z] and nothing else
wily xenial yakkety zesty and artful
 
Yeah. Same in Debian.
If you want to only accept lower-case letters you can use [[:lower:]] in place of \w.
 
on the grep line?
 
It works in both grep and sed. It's part of POSIX BRE and POSIX ERE.
So, I don't know if this is what you'll decide on but suppose you decide you want to use the parsing logic grep uses with sed as well for parsing out the codename from /etc/lsb-release. With grep you have:
lsb_release -c | grep -oE '\w+$'
So for the other brance, still with sed, for explicitly reading from the file, you could use:
sed -nr 's/^DISTRIB_CODENAME=(\w+)$/\1/p' /etc/lsb-release
And then in each case you can replace \w with [[:lower:]] to allow only lower-case letters, if that's what you prefer to do.
lsb_release -c | grep -oE '[[:lower:]]+$'
sed -nr 's/^DISTRIB_CODENAME=([[:lower:]]+)$/\1/p' /etc/lsb-release
(Sorry, I had some output included there, but I've removed it now.)
* other branch
 
yep this would make at least sure we catch only lower letters
lol ok im a madman lol
6:14 am and i not even recognized it
the here file does not like to be indented :)
 
5:19 AM
Yeah, if you want to indent the here document, then you have to use tabs and the - syntax in the word. From 3.6.6 Here Documents:
> If the redirection operator is <<-, then all leading tab characters are stripped from input lines and the line containing delimiter. This allows here-documents within shell scripts to be indented in a natural fashion.
 
well lets continue that later , i should have at least some rest, now i introduced a wicked set of ifs there
when i fail to sed the dist name i end up having to input it
deliberatly failed it
for testing
by changing the filename
 
Oh, you may want to check if the name the user inputs is reasonable, too.
Though I don't know if it should be a warning or an error if it's not.
@Videonauth Ok, feel free to ping me. I may not be around or available when you do but I'll make sure to check the ping and reply, either immediately or eventually. Good night/morning!
 
well for you its late night now i think
for me it early morning
and my cat is nagging me to lay on my bed so she can snuggle up, that was what let me have a look at the clock
 
6:13 AM
well this is probably a bad idea
i just backed up my pgp private key, and then encrypted it with itself, and then put that into Keybase's encrypted Git.
i'd assume the chances of both my primary and backup yubikeys all failing is pretty low, so it should be safe?
tldr: i backed up my pgp private key, and then encrypted it so i need my private key to read it.
 
 
1 hour later…
7:22 AM
-4
Q: need a script to rename content in file

user258437I have file like this , oldfile: hotname : test1 Ip : 1.1.1.1 hostname : test2 ip : 2.2.2.2 likewise 1000 lines which contain hostname and ip. i want to change the hostname only by reffering another file, newfile: hostname : test123 ip : 1.1.1.1 i need unix script

 
7:58 AM
0
Q: Can someone recommend a firewall product with good Linux vpn support

simgineerWe use Citrix at work and I am able to vpn in with Ubuntu 14.04 but am having issues with 16.04. I am wondering if someone could recommend a firewall or vpn product that has good vpn support for Linux clients.

 
8:25 AM
0
Q: Ubuntu boot partition corrupted

vipulsodhaI was trying to increase the partition size of my ubuntu in dual boot with windows 10 using gparted from live usb. While the partition was happening my pc shut down and the partition i was trying to increase the size got corrupted. Now When ever i try to restart grub terminal gets open and ubuntu...

0
Q: gpg decryption --passphrase Ubuntu Server

Zakk CoetzeeI decrypt a file with the following : gpg --armor -r"company_prod " --passphrase password --decrypt-files filename.rar.asc I would like to know why the passphrase is asked for once and after it's entered and I run the command again it doesn't ask for the passphrase? As if it doesn't read the ...

 
8:59 AM
0
Q: Linux Mint file manager file,folder name not showing

Bipul Roy Bplsometime i don't shutdown my machine and it goes logout mode. After login back sometime the folder and file name don't show up like this image : if i shutdown my machine then everything runs fine,please suggest me what should i do to fix this problem, startx solves but needs to restart, i want ...

 
 
1 hour later…
10:12 AM
Hey guys. Just a quick question. Ubuntu does not mount drives in a live session correct? You have to do that manually via file manager right?
 
When I have used Ubuntu live environments, Ubuntu has not automatically mounted external storage devices if they were already plugged in. But it should mount them if you plug them in once the system is running, I believe.
However, I do not have a good source for that, only my personal experience. There are also a number of "flavors" of Ubuntu, running different desktop environments, and they may behave differently in this regard.
Why do you ask? Do you need to prevent a device from being mounted? Or are you having trouble getting on to mount?
 
Okay. I'm asking because I sometimes shred a PC's HDD from a Ubuntu live session. For that to work properly the device should not be mounted. I never check beforehand as I assumed the system's HDD would not be mounted in a live session...
I just open up a terminal and go "sudo shred -vzn 0 /dev/sda". It's the fastest way to safely erase a drive I know of...
 
Oh. Well you can just unmount it if it mounts, right?
 
How would you double check that sda is not mounted via terminal?
 
Run mount with no arguments.
 
10:18 AM
@H3R3T1K no and no. you can click on the drive icon to mount it (from launcher and/or desktop if set to show)
 
mount
 
Thanks guys!
 
Anyway, if it is mounted, then at least for a removable storage device, I don't recommend unmounting it by clicking the eject icon in the file browser if you plan to use the device while it's still plugged in. Based on the last time I was doing this sort of thing, I believe that actually does more than unmounting it. I expect Rinzwind knows better than I do on this, though. In any case you can certainly unmount it with the umount command (you may need to use sudo umount).
 
I'm not talking about removable devices but the PCs main drive (sda)...
 
Oh. Yeah that shouldn't be mounted automatically in the live system.
But you can just type mount and press enter to see what's currently mounted.
 
10:23 AM
Thank you!
 
@H3R3T1K me too
 
 
1 hour later…
11:52 AM
0
Q: pdftk can't handle emdashes in filenames

Max WilliamsI'm trying to use pdftk (v 1.40) to combine some pdfs (using it's cat command). As a simple test, I can do pdftk "/home/deploy/Foo - Bar.pdf" cat output results.pdf and that works fine (I'm only combining one file here, but it's still a valid test). But, if the filename has an emdash it bal...

0
Q: Ubuntu server 17.04 PCI-DMA out of IOMMU space. Status DRDY

Chris PaveyI'm trying to install ubuntu server 17.04 on a system running 4 disks in a RAID 10 array. I'm getting a lot of errors, see attached. Can somebody please tell me what is going on. Are these errors something to be concerned about?

 
 
1 hour later…
1:10 PM
Hello :)
 
 
1 hour later…
jrg
2:32 PM
well, canonical joined the gnome advisory board insights.ubuntu.com/2017/11/01/…
that'll be interesting to watch
 
0
Q: WiFi card installed but no network detected

user258502I just installed Ubuntu 16.04 as I need a Linux system for uni studies. I have a Realtek8723AE wireless network card which has been detected without problems during installation. The problem is I cannot see any wireless networks available. It is not my routers fault, as all other wireless devices...

 
eyyy
the latest Adam Ruins Everything referenced Animaniacs
 
 
2 hours later…
4:52 PM
@KazWolfe The OP seems to have a non working Internet connection.
wget works on my side for that file
 
5:09 PM
@Videonauth though they don't need to do that at all - they've already installed the package.
 
I know , the question should have been why does wget fail :)
 
OP's internet appears to work anyways, they downloaded unrar from the repos and can ping out.
 
ping with a lot duplicate and damaged packages
if you ask me he could be happy that the unrar install didn't phase out
and 500-600 ms ping is not a good sign
 
i get that on occasion.
 
well for me its most of the time below 15 ms
in worst cases it stalls completely (if my ISP fucks it up) max i have seen here have been 120ms
 
5:16 PM
i've gotten 3400ms at some points on "normal" days
I love satellite interent
 
but did you get then duplicate packages?
 
i got a lot of weird things
 
ok :)
well who am i to argue it is accepted and answered
 
5:37 PM
Today is Chrome extension writing day.
 
is it?
 
I'm writing a native message handler.
It's the only way a Chrome extension can access the local filesystem.
 
5:56 PM
oops ...
Not working. 'sudo' is not recognized as an internal or external command, operable program or batch file. — Hetal 1 min ago
Anyone ideas?
 
@Videonauth what version of ubuntu? some vpses will remove sudo for reasons
 
No clue check the question, he treid to install django and gets a cert error, i sugested using the version in the repositories.
 
6:22 PM
@jrg oh god
 
@jrg hopefully good things will come of it
 
> The board’s responsibilities are summarised as: to meet with the GNOME Foundation board of directors to explain their needs, to learn more about the needs of GNOME users and to provide feedback on the overall direction of the GNOME project.
"Gnome sucks, and we need to be able to customize our desktop"
 
What the heck.
What a bizarre bug.
Chrome native messaging doesn't work with the Inspector open.
But as soon as I close it, everything works again.
 
sounds like a feature
 
Blech.
 
00:00 - 19:0019:00 - 00:00

« first day (2590 days earlier)      last day (2375 days later) »