bash

For loop over sequence of large numbers in Bash [duplicate]

浪尽此生 提交于 2021-02-08 06:04:33
问题 This question already has answers here : Bash command line and input limit (3 answers) Closed 2 years ago . In a Bash script I am using a simple for loop, that looks like: for i in $(seq 1 1 500); do echo $i done This for loop works fine. However, when I would like to use a sequence of larger numbers (e.g. 10^8 to 10^12), the loop won't seem to start. for i in $(seq 100000000 1 1000000000000); do echo $i done I cannot imagine, that these numbers are too large to handle. So my question: am I

How to get the exit status of multiple parallel background processes in bash [duplicate]

孤街醉人 提交于 2021-02-08 06:04:28
问题 This question already has answers here : How to wait in bash for several subprocesses to finish and return exit code !=0 when any subprocess ends with code !=0? (31 answers) Closed 3 years ago . In Bash, I want to call a command multiple times in parallel, while capturing all the processes exit codes. I know how to start and wait for them, but wait will only give me the exit code of the last process exiting. I also need the exit code of the shorter lived processes. Unfortunately I don't have

Replace blank fields with zeros in AWK

跟風遠走 提交于 2021-02-08 05:59:00
问题 I wish to replace blank fields with zeros using awk but when I use sed 's/ /0/' file, I seem to replace all white spaces when I only wish to consider missing data. Using awk '{print NF}' file returns different field numbers (i.e. 9,4) due to some empty fields input 590073920 20120523 0 M $480746499 CM C 500081532 SP 501298333 0 M *BB 501666604 0 M *OO 90007162 7 M +178852 90007568 3 M +189182 output 590073920 20120523 0 M $480746499 CM C 500081532 SP 501298333 0 0 M *BB 0 0 0 0 501666604 0 0

Is bash leaking memory?

一笑奈何 提交于 2021-02-08 05:55:09
问题 I'm running bash v4.4.19(1)-release on Ubuntu 18.10. If I run valgrind on a simple script (or even bash --version ), I'm seeing that I definitely lost 12 bytes of memory and there's on the order of 46kB still reachable. The still reachable memory doesn't bother me so much since I know bash is going to do it's thing with process handling and deallocation, but what I don't understand is why I'm losing these 12 bytes. Here's an example of a simple test script I'm using (filename is t.bash): #!

How to change the default python version in Raspberry Pi

流过昼夜 提交于 2021-02-08 05:16:33
问题 One day ago I did a fresh installation of Raspberry Pi OS Buster and after that I installed Python3.8 in my Raspberry pi following this tutorial. https://installvirtual.com/how-to-install-python-3-8-on-raspberry-pi-raspbian/ I added python alias to bashrc. echo "alias python=/usr/local/bin/python3.8" >> ~/.bashrc source ~/.bashrc Now typing python in terminal showing Python 3.8.0 (default, Jun 8 2020, 13:17:16) But when I run python3 it's showing Python Python 3.7.3 I added python3 alias

How to determine how much CPU load is produced from processes running under some user in Linux? [closed]

雨燕双飞 提交于 2021-02-08 05:15:42
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 9 years ago . Improve this question I would like to make a simple monitoring script that will record CPU load produced by user "abc" in a text file. vmstat, iostat, mpstat and free do not seem to have a capability to filter based on user name. Is it possible at all? EDIT : Btw. I'm running on Red Hat EL 6.0. 回答1: A simple way

How to determine how much CPU load is produced from processes running under some user in Linux? [closed]

左心房为你撑大大i 提交于 2021-02-08 05:14:43
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 9 years ago . Improve this question I would like to make a simple monitoring script that will record CPU load produced by user "abc" in a text file. vmstat, iostat, mpstat and free do not seem to have a capability to filter based on user name. Is it possible at all? EDIT : Btw. I'm running on Red Hat EL 6.0. 回答1: A simple way

Flutter desktop - send PDF to a printer

*爱你&永不变心* 提交于 2021-02-08 04:23:29
问题 I have a requirement to print PDF on the printer from the Flutter app. Is there a chance to have a possibility to do so right now? I mean that my application is going to fetch the PDF file from the server and then I would like to put it directly to the printer, so it can be printed instantly. The platform that I am targetting is windows. If this is not possible then is there a chance to execute .bat script using flutter? In the case that there would be no such possibility I could make the

Flutter desktop - send PDF to a printer

余生长醉 提交于 2021-02-08 04:23:08
问题 I have a requirement to print PDF on the printer from the Flutter app. Is there a chance to have a possibility to do so right now? I mean that my application is going to fetch the PDF file from the server and then I would like to put it directly to the printer, so it can be printed instantly. The platform that I am targetting is windows. If this is not possible then is there a chance to execute .bat script using flutter? In the case that there would be no such possibility I could make the

Remove duplicate filename extensions

不羁岁月 提交于 2021-02-08 03:50:21
问题 I have thousands of files named something like filename.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz I am using the find command like this find . -name "*.gz*" to locate these files and either use -exec or pipe to xargs and have some magic command to clean this mess, so that I end up with filename.gz Someone please help me come up with this magic command that would remove the unneeded instances of .gz . I had tried experimenting with sed 's/\.gz//' and sed 's/(\.gz)//' but they do not seem to work (or to