Running this script, bash ./cleanup.bash, Gives the error: cleanup.bash: line 10: syntax error near unexpected token ‘(‘ cleanup.bash: line 10: ‘rm -rf !(composer.json|.git)’ But if I run in in the terminal directly, there aren’t any problems: I tried stripping out all other line…
What does “~[]” do?
I saw the following line of code here . I don’t understand, what does empty array script([]) do? Also, What is the purpose of ~[] in C? Answer The linked program seems to be logging its actions in some invented semi-formalized language. This logging “language” is not C. The string literal in…
How to close all open terminal windows except the one running a shell script
I wanted to have a script that is capable of killing console windows, that are either running something or not, but at the same time, keep alive the window that executed this script. Thanks for your help Answer You can find the command name of the parent the script (bash, sh, zsh, etc.) then kill all the proc…
Bash script that will read a number from file and run command if number equals or is higher than X value
I would like to have a script that reads a number from a file, and if this number equals or higher a certain value, it will run another command, if not, script will just die, it would be something like this: Thanks for any help. Answer
advanced printf explanation in bash
I just found this programming segment in my son’s Bash file. I am quite a newbie and unable to understand the printf syntax. Can someone explain me the COMMENTED printf in the segment below?? Answer It’s is nothing but a busy/wait spinner and the lines commented do nothing but set a blue foregroun…
How can I execute a command inside another folder and return to original directory?
I use this command to make inside a folder: But I want to return to original directory after the command I tried this: But this doesn’t work. How can I do it? Would help in quick testing… Answer Use a subshell, like so: The shell forks before running the commands in brackets, so once it completes …
write error disk full in EC2 Machine [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …
Error in malloc while trying to create a thread
Hi everyone i post only the core of the code which create probleam and which work with threads. As we can see foo function create new thread and reallocate memory to store the pthread_t. Then it try to create a new thread with pthread_create as NULL as attr and arg and as function pointer a pointer to foo2; N…
Kivy VM Buildozer Command Failed
I recently learned about kivy and tried to make a very simple little app just to test it. To try it out properly I used the kivy launcher but also felt compelled to try and compile it to an APK for my android phone. So I downloaded virtual box and installed linux mint on it. After installing things like java,
Why am I getting an error message when trying to “cat” my char device driver?
I’ve written a simple character device driver for Linux. It is a simple message storing/retrieving system where the messages are stored in kernel space. I should be able to do something like this: and then retrieve the message with The messages are stored in a queue. When I try to retrieve a message tha…