370 reputation
113
bio website
location Hungary
age 15
visits member for 3 years, 10 months
seen Nov 18 at 16:00

StackFlair


Nov
6
comment How do I set a user environment variable? (permanently, not session)
This is not a full answer, but if it's shell-specific, I recommend putting it in .bashrc; if it's not, put it in .profile. I source .profile and .bashrc (in that order) from .bash_profile, and make sure to put [[ $- != *i* ]] && return on the top of .bashrc.
Nov
5
comment Modify a file without creating another file
I can't see any globs there.
Nov
5
comment Modify a file without creating another file
I submitted an edit with some improvements. While it may not exactly be suitable for an edit, I'm hoping to save you some work.
Nov
5
suggested suggested edit on Modify a file without creating another file
Nov
5
comment Modify a file without creating another file
I think you forgot to define pattern and replacement, too.
Nov
5
comment Modify a file without creating another file
Also, if it's a bash script, you can just do grep -q "$pattern" <<< "$line".
Nov
5
comment Modify a file without creating another file
That script suffers from multiple issues. (1) read line should be read -r line. (2) The $() in the if is redundant. I'm surprised if that even works. (3) echo suffers from a lot of portability issues even within bash. Use printf '%s\n' "${var}" instead. (4) $1 should be wrapped in double quotes: "$1".
Nov
5
comment Getting 256 colors to work in tmux
-1, you shouldn't set either unconditionally in your shell initialization file. Setting it to xterm-256color will override it inside tmux as well, and setting it to screen-256color outside of tmux could lead to display bugs.
Nov
4
revised Adding to path vs. linking from /bin
edited body
Nov
4
revised How to get the name of the user who executed a bash script as sudo?
fix script as OP's intent is clear per comments; improve spelling/grammar; update tags
Nov
4
suggested suggested edit on How to get the name of the user who executed a bash script as sudo?
Nov
4
awarded  Organizer
Nov
4
revised How to get the name of the user who executed a bash script as sudo?
add explanation
Nov
4
revised Transfering millions of files from one server to another
improve title, grammar and spelling, update tags
Nov
4
comment Transfering millions of files from one server to another
I suggest adding the -h flag to use human-readable units. And if you want more verbosity, you have a few options: -i and/or -v/-vv.
Nov
4
comment Transfering millions of files from one server to another
You should probably add more information on the significance of the trailing slash. From the rsync manual page: "A trailing slash on the source changes this behavior to avoid creating an additional directory level at the destination. You can think of a trailing / on a source as meaning "copy the contents of this directory" as opposed to "copy the directory by name", but in both cases the attributes of the containing directory are transferred to the containing directory on the destination."
Nov
4
suggested suggested edit on Transfering millions of files from one server to another
Oct
31
comment Arithmetic operations with expr and variables
This is irrelevant to your issue, but you should not be using backticks, they're deprecated. Use $() instead, like so: total=$(expr ...)
Oct
29
comment How to treat strings with spaces as a whole in bash?
It appears to be undocumented on Debian too, but it's in the man page on Arch Linux. Not sure why.
Oct
29
comment How to treat strings with spaces as a whole in bash?
The output of date --rfc-3339=seconds still contains spaces, why not date --iso-8601=seconds (or just date -Iseconds)?