I lost my .bashrc and .bash_aliases file. Aliases stll work, just now file. Looked in home and etc (ubuntu server) - no luck.
When I encrypt a file with gpg, the encrypted version is output in the same directory as the source file.
Can that be changed?
With the gpg --encrypt --sign -r <email.address> file-name, the new file is placed in the same folder.
I canāt find anything in the manual about specifying were the output should be.
Eg, a .tar file is on hdd 1, and the .tar.gpg files should be created on hdd 2.
Since it is standard shell, replace filename with /mnt/mydisk/folder/filename, where /mnt/mydisk/folder is the folder you want to store the file in.
If you use standard input to gpg, you can direct the output wherever you like.
anyone know of an ansible module that will check for a file before running a command or do I have to register the output and then check it?
set -e
is not exiting on bad substitution
for me, is that normal?
did you try adding at the end
-o /home/donk/folder/newfilename.file
so
gpg --encrypt --sign -r <email.address> file-name -o /home/donk/folder/newfilename.file
or -This didnāt work for me
gpg --encrypt --sign -r <email.address> file-name > /folder/newfilename.randomextension
#IHaveNoIdea
#JustAskinForKicks
[edit added long ask arguments. I donāt know why discorse adds colours, unless itās just on my screen]
Code syntax highlighting inside the code blocks. It is just failing to select the correct language, you would have to manually set it.
Thanks. I presume it would also explain why different bits got different colours?
Yep. Probably defaults to c++ or something.
Yep, it tried and failed to detect language multiple times.
First one assumed it was a diff. Second one assumed xml probably. Dunno about 3rd.
Okay, what seemed to work for me was:
gpg --encrypt --sign -r <email.address> -o /path/to/folder/newfilename.file file-name
Shell highlighting by default. Apparently starting a line with a hyphen is highlighted in red.
Which of these is preferable (or is there a better way to get the default gateway interface)?
ip route show default | sed -e 's/^.*dev \([[:alnum:]]*\).*$/\1/'
ip route show default | grep -oP '(?<=dev )[^ ]*'
Technically the sed
command is more portable, but it doesnāt really matter since ip
isnāt. Neither is very legible.
I can use awk
which looks better but is less safe. While this appears to work, I do see differences in ip
output fields between Debian and RHEL distros which makes me hesitant to rely on it.
ip route show default | awk '{ print $5 }'
Is there any way to control what fields ip
spits out like with nmcli
? I donāt see anything in the docs.
Efficiency-wise, Iād assume grep is the winner, but the execution times are all within .002 seconds, so who cares.
Personally, Iād use grep, but thatās because Iām a pleb.
That said, Awk is probably the correct tool.
Yeah, if I really wanted to use awk, I guess I could:
ip route show default | awk '{for(i=1;i<=NF;i++)if($i=="dev")print $(i+1)}'
Pretty gross imo.
Iāll have to think on it. For grep, I just donāt want to rely on non-portable flags.
well you might want to just use sed or awk then.
nmcli
What would the nmcli command be?
Probably still have to grep the outputā¦ I donāt think there is a way to directly show the gateway.