Looking to find the practical reasons the command tar -c /filea > /fileb gives the following output: tar:Removing_leading / from member names. I have researched it quite a bit but only come across very vague reasons such as protects against some sort of attack etc. The majority just give explanations on a …
Tag: bash
Generating systematic incremental numbered filenames in Bash
I have a random number of files with names as: Note that the number of .txt files varies in different directories. For example, a directory may contain only one id_1000.txt (at least) or may contain any number of files with any higher number of digits. To convert the random number of filenames in systematic i…
When there are multiple “spawn” statements in the expect script, only the last spawn statement is executed fully
From expect script, I am calling two other shell scripts. But only the second shell script seems to get executed properly. Because the output statements of the first shell script is not seen in the screen. This is my expect script: Why is this happening? And what is the fix? Answer You have to wait for the fi…
Shell script works in bash but not on ‘adb shell’
Below shell script works perfectly fine in bash shell. But produces an error in android shell. May be it has got to do something with the shell that android is using. But how can I resolve it? If not a perfect solution, an hack would also do for me. Shell-script : O/p In android shell, O/p on bash shell(Linux…
How to store value from grep output in variable
I am working on one bash script, in which I have to use the regular expression to match string and then store the output in a variable to reuse it. here is my script, I tried this many ways, but I am getting error : ./check.sh: MET-3-get-issue-id-from-branch-name: not found if I run individual grep command th…
.bashrc file preventing some SFTP GUI APP from logging to the VM
I have a .bashrc file running on my Ubuntu server I can log-in to my VM perfectly fine via SSH. I am not sure why in some SFTP client (GUI Apps) like Cyberduck preventing me from log-in into my VM. But when remove my .bashrc or deactivating it, it works fine. Questions Is there a main reason behind this ?
Using Windows Subsystem for Linux (WSL) from Sublime Text
I wanted to use gcc, g++ and make from Sublime Text to be able to compile C and C++ code to Linux runnables on Windows. I couldn’t run bash.exe from Sublime Text, as many other users on Stack Overflow. Answer You have to copy the C:WindowsSystem32bash.exe file to the C:WindowsSysWOW64 directory. Require…
qt run shell commands via qprocess
I am developing a small QT application to interact with the terminal, to send commands to the terminal and to read back information printed out. Example: get output of all processes using ps -aux PROBLEM I am able to write information out to the terminal but I dont think it is in the system scope, actual exam…
How To Delete A File Every X Times A Script Is Run – Manage A Log File From Inside A Script?
I would normally just schedule this as a cron job or script, however, I would like to delete a log file (it’s constantly appended to every time a script runs) only after 50 times. Needed Inside The Script: The thing is, since the script does not run consistently, it has be to be implemented within the s…
How to run a command in bash which captures the output and waits until the command has finished?
I am using the following in a bash script: command >> /var/log/somelog.log 2>&1& The reason I’m doing this is because I want to capture all output in /var/log/somelog.log. This works fine. However it does not wait until the command has finished. So that brings me to the question, how ca…