shell Questions
5
Solved
I am fairly new to running scripts in UNIX/Linux. I have a .env file containing environment information and a .sh script containing folder creations etc for that environment.
How would I run the s...
2
Solved
3
I would like to execute the below curl command and specify my own key store.
I tried using --cacert option and specified the path of the cacert jks.
curl --ssl-reqd --url 'smtp://mailhost.myorg.com...
3
Solved
sort doesn't seem to like my key specification. Why?
~/tmp $ sort --version
sort (GNU coreutils) 8.25
Packaged by Cygwin (8.25-1)
~/tmp $ echo 'a;b;c;d;e;f;g'|sort --field-separator=';' --key=1,5,...
Advocation asked 6/7, 2016 at 10:5
8
awk -F: '{ printf "%-3s %-2s","\n" $1 $2; }'
How do i add in color code? '\e[1;32m'
I try adding in to printf, it give me output of the string instead of color code..
'\e[1;32m' .......
5
Solved
Sometimes I need to save the last typed shell command into the clipboard.
I can do something like this:
echo !! | xsel --clipboard
Which works successfully.
But when I try to alias the above comma...
13
Solved
I am generating a PDF dynamically. How can I check the number of pages in the PDF using a shell script?
11
Solved
I am trying to capture output from an install script (that uses scp) and log it. However, I am not getting everything that scp is printing out, namely, the progress bar.
screen output:
Copying...
22
Solved
How do I check the validity of an IP address in a shell script, that is within the range 0.0.0.0 to 255.255.255.255?
4
Solved
I want to test the output of a bash script when one of the executables it depends on is missing, so I want to run that script with the dependency "hidden" but no others. PATH= ./script isn't an opt...
5
Solved
So I'm creating a GitHub Pages site to list all of the Gifs in my jglovier/gifs repo. GH Pages runs only static HTML/CSS/JS or Jekyll, so I cannot use an apache directory listing or any other serve...
3
When using the ! shortcut to execute shell commands from a Notebook, how can I respond to subsequent prompts?
For example: !read varname Seems to hang the kernel indefinitely and I can't run anoth...
Sweatbox asked 7/2, 2019 at 21:12
5
Solved
I'm trying to rename all files in current directory such that upper case name is converted to lower. I'm trying to do it like this:
ls -1|gawk '{print "`mv "$0" "tolower($0)"`"}'|xargs -i -t eval ...
8
Is there a convention for documenting shell scripts' parameters?
For example:
#!/usr/bin/env bash
# <description>
#
# Usage:
# $ ./myScript param1 [param2]
# * param1: <description>
...
7
Solved
I'm streaming data using netcat and piping the output to gawk. Here is an example byte sequence that gawk will receive:
=AAAA;=BBBB;;CCCC==DDDD;
The data includes nearly any arbitrary characters, ...
6
Solved
On one of our remote systems mkdir -p $directory fails when the directory exists. which means it shows
mkdir: cannot create directory '$directory' : file exists
This is really puzzling, as I ...
3
I have a requirement where I am trying to write a shell script which is calling curl command internally. I have the password, username and url stored as variables in the script. However, since I wa...
5
A while ago I saved some images generated by a web service so the file names are e.g 'ysauyft87ggsa67fgeg&w=1600'. I can open and manipulate these images OK, I'd just like to know what encoding...
18
Solved
I am trying to automate mysql_secure_installation script with automated response. My code is as follows :
echo "& y y abc abc y y y y" | ./usr/bin/mysql_secure_installation
The actual questi...
4
Solved
So I want to set some paths differently depending on the host, but unfortunately it's not working. Here is my script:
if [$HOSTNAME == "foo"]; then
echo "success"
else
echo "failure"
fi
This i...
5
Solved
My MongoDB is hosted on compose.io and is called ScroungeBA.
I try to create a user with some built-in roles which by the documentary only work in the admin database:
MongoDB provides all other...
Breeching asked 7/8, 2015 at 9:19
7
Solved
I have the following scenario: I have an env variable $SOME_IP defined and want to use it in a nginx block. Referring to the nginx documentation I use the env directive in the nginx.conf file like ...
Morena asked 18/2, 2014 at 22:5
8
Solved
I am trying to find a way for grep to output only the content of a capturing group. For instance, if I have the following file:
hello1, please match me
hello2, please do not match me
I would like
...
4
I have a django app and I am running some unit tests on it. So the problem I am having is not when one test inserts into the test db. It is the tests that come after. Since each test is not saving ...
3
Solved
I'm using ssh command to remotely executing a shell script with -o **StrictHostKeyChecking=no ** option to bypass the authentification:
ssh -o StrictHostKeyChecking=no root@$IP '/test-script'
Howe...
© 2022 - 2025 — McMap. All rights reserved.