I’m looking for something that will translate a string as follows, using only bash / standard Linux commands: Single-quotes surrounding a string should be removed Double-quotes surrounding a string should be removed Unquoted strings should remain the same Strings with unmatched surrounding quotes should remain the same Single-quotes that don’t surround the string should remain Double-quotes that don’t surround the
Tag: bash
Pipe to/from the clipboard in a Bash script
Is it possible to pipe to/from the clipboard in Bash? Whether it is piping to/from a device handle or using an auxiliary application, I can’t find anything. For example, if /dev/clip was a device linking to the clipboard we could do: Answer 2018 answer Use clipboard-cli. It works with macOS, Windows, Linux, OpenBSD, FreeBSD, and Android without any real issues.
Resize a list of images in line command
I would like to resize a list of images, all in the directory. To achieve that, I use convert from imagemagick. I would like to resize into I was wondering if there is a method to achieve this in a single command line. An elegant solution could be often useful, not only in this case. EDIT: I would like a
How to list running screen sessions?
I have a bunch of servers, on which I run experiments using screen. The procedure is the following : ssh to server XXX launch screen start experiments in a few tabs detach screen disconnect from the server While the experiments are running, I can easily find on which servers they are by sshing to all servers and listing my running
Bash script to create symbolic links to shared libraries
I think this question is rather easy for you shell scripting monsters. I am looking for the most elegant and shortest way to create symbolic links to shared libraries for Unix by means of a bash shell script. What I need is starting out with a list of shared library files such as “libmythings.so.1.1, libotherthings.so.5.11”, get the symbolic links created
Execute several programs at the same time in an initialisation/bash script
Hello I am working with a simulator that uses rcS scripts to boot, this is my script What I want is run all the test at the same time and that the exit command is executed only when all the previous test have finished. And not only when test 4 has finished, is this possible?. Thank you. Answer You can
Setting environment variables in Linux using Bash
In tcsh, I have the following script working: What is the equivalent to the tcsh setenv function in Bash? Is there a direct analog? The environment variables are for locating the executable. Answer export VAR=value will set VAR to value. Enclose it in single quotes if you want spaces, like export VAR=’my val’. If you want the variable to be
Find all storage devices attached to a Linux machine [closed]
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 10 years ago. Improve this question I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted. The dopey way to do
How do I use sudo to redirect output to a location I don’t have permission to write to? [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 Exchange site, you can leave a comment to explain where the question
How to generate a core dump in Linux on a segmentation fault?
I have a process in Linux that’s getting a segmentation fault. How can I tell it to generate a core dump when it fails? Answer This depends on what shell you are using. If you are using bash, then the ulimit command controls several settings relating to program execution, such as whether you should dump core. If you type then