Skip to content

Tag: shell

If not exists, create a folder – Error in makefile

I searched over the internet for a command to create a folder if it doesn’t exist. I found it and put in my makefile When the folder doesn’t exist it’s created correctly. But I get an error if the folder already exists. I don’t get why the command would give an error if the condition [ ! -d “myfolder” ]

echo printing working directory files names for no reason

why echo printing the files names ? gives this output but running pacmd list-sinks | grep “index:” in the shell gives * index: 1 index: 2 index: 3 Answer pacmd returns * pattern. In for … in …; do … done loop, the list pattern contains * without any protection. So, bash replace * by all files found in current

Pipe into a shell/bash script from Web URL

How to download a script from URL, execute it, and pipe something into it – all with one command? I have a shell script to which I can pipe stuff: The script is moved to Try to do something like this: but it doesn’t work. Data does not get piped into the script. There is a workaround, but how

what alternative methods for sudo echo without bash -c

I must run the echo in the script with sudo because permission. I do not want to execute the script with sudo I do not want to use bash -c “…” because escaping. Are there no other solutions? Answer The problem you are encountering here is that the output redirection >/file.tmp has to happen with elevated privileges.

Bash script conversion to fish

I’m trying to convert this script to fish: This is my progress so far: It should be fully converted except that main command substitution in the last function: that raises this error: And I don’t understand how to convert it. Can you help me? Thanks Answer Found the correct way to convert it (thanks to @masahide:

How echo grave accent symbol in bash

(_ is input, i think) Answer Escape the grave accent. It’s special to the shell and is one way (the archaic one) to do command substitution. As noted by @dave_thompson_085 an alternative is to use single quotes in lieu of the double quotes you used, or to specify the hexadecimal representation of the grace accent, by doing echo “x60”. You