Skip to content
Advertisement

Tag: bash

Stripping single and double quotes in a string using bash / standard Linux commands only

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

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

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

Advertisement