21,080 reputation
34678
bio website
location United States
age
visits member for 3 years, 6 months
seen 1 hour ago

Debian user, GNU/Linux enthusiast, FLOSS supporter, hobby developer.


Dec
11
comment Storing longer text output in memory in shell variables vs Writing to disk
By my understanding of the question, this "answer" is mostly off-topic and irrelevant. The first sentence gives a rough "probable" answer which I already mentioned in a comment, and the rest of it proceeds to veer off-topic into explaining why a dumb command that nobody would want to run anyways may not work.
Dec
11
comment Storing longer text output in memory in shell variables vs Writing to disk
@mikeserv Ok you've lost me. All I thought we were trying to do is put the contents of a shell variable into a file. The answer I am commenting on is suggesting /bin/echo ${VARIABLE} >> file, and I am saying that there is no reason to use /bin/echo over a shell built-in. What are you trying to do?
Dec
11
comment Storing longer text output in memory in shell variables vs Writing to disk
@mikeserv If the goal is simply to get the contents of a shell variable into a file, you don't need to use exec() functions at all. If the shell does something natively without calling any exec function, there is no argument list at all. There is no reason to try to put this shell variable into the environment.
Dec
10
comment Storing longer text output in memory in shell variables vs Writing to disk
The argument list too long problem can easily be bypassed. It's not really worth mentioning here. Who would use /bin/echo when nearly every shell has a built-in version?
Dec
10
comment Storing longer text output in memory in shell variables vs Writing to disk
@dbza Maximum size probably will not matter. As far as disk I/O goes, buffering more than a few megabytes is probably not going to improve performance. Even if a shell has an unlimited variable size, at some point you are going to run out of memory, and your kernel is going to start swapping, at which point you've probably already lost any performance benefits you might have gained.
Dec
10
comment Storing longer text output in memory in shell variables vs Writing to disk
@dbza You should try it yourself. Whether it will make a difference really depends on how slow your disk is. Another thing you can do is move the redirection outside the loop, as long as your loop doesn't output anything else.
Dec
10
comment Storing longer text output in memory in shell variables vs Writing to disk
If all you are doing is appending output to a file what is the point of putting it all in a variable first? What else are you doing with the data?
Dec
8
comment Sorting a file based on second column in a Tab Spaced file
Sorry, it won't let me submit without an account. If you want help you are going to have to actually tell us what the problem is.
Dec
8
comment Sorting a file based on second column in a Tab Spaced file
I typed exactly what you have in to the website and it says it worked for me.
Dec
8
comment Sorting a file based on second column in a Tab Spaced file
It's better to copy and paste the question text instead of linking to it.
Dec
8
comment How can I run a command in bash after any change in $PWD?
@NathanLong that's only for my operating system. Operating system seems irrelevant here. Does OS matter? It's the shell that matters in your question, and you seem to be specifically asking about bash, which works pretty much the same on all operating systems that it runs on.
Dec
8
comment How can I run a command in bash after any change in $PWD?
@NathanLong "how many other ways are there to change directory" - I don't know - You can find out though, because the number of shell builtins is limited and can be found in the manual.
Dec
8
comment How can I run a command in bash after any change in $PWD?
What tool do you keep referring to? Why not use zsh? The DEBUG trap approach is pretty clunky too because there is only one DEBUG trap so if every add-on script that tries to be clever has the same idea they will clobber each other.
Dec
6
comment Video-inverting my bash prompt
@SopalajodeArrierez A leading zero is part of the conventional syntax for denoting octal notation, and octal is what is required here. 033 is 27 in decimal (3 * 8 + 3), not 33.
Dec
6
comment How can I run a command in bash after any change in $PWD?
Why not redefine cd, pushd, and popd? How many other ways are there to change directory?
Dec
3
comment Why are some processes “killable” by pkill but not killall?
Doesn't your linked question answer yours? killall does exact matching but pkill does not. Is that not the answer?
Dec
3
comment Repeatedly execute bash command while there's no output from another process
Update your question. What is this command that runs every 5 seconds supposed to accomplish?
Dec
3
comment Repeatedly execute bash command while there's no output from another process
What are you trying to accomplish?
Dec
3
comment Repeatedly execute bash command while there's no output from another process
Does fs_usage ever terminate? If not you need a different approach. What tail does is get you the last line(s). It can't know what the last line is until its input terminates, so as long as the pipe chain is held open tail will never output anything.
Dec
3
comment How to move a file and change its name without retyping the name and just add the new characters
You should specify what shell you are using.