scripting

SSH Remote command exit code

≡放荡痞女 提交于 2021-01-29 06:06:06
问题 I know there are lots of discussions about it but i need you help with ssh remote command exit codes. I have that code: ( scan is a script which scans for viruses in the given file) for i in $FILES do RET_CODE=$(ssh $SSH_OPT $HOST "scan $i; echo $?") if [ $? -eq 0 ]; then SOME_CODE The scan works and it returns either 0 or (1 for errors) or 2 if a virus is found. But somehow my return code is always 0. Even, if i scan a virus. Here is set -x output: ++ ssh -i /home/USER/.ssh/id host 'scan

Powershell WSB Script

纵然是瞬间 提交于 2021-01-29 05:35:48
问题 I have a backup script WSBREPORT which works fine. However, I am using an SMTP server that needs authentication. So I have a script separately that works and creates an encrypted txt file with the password. What I can't seem to achieve is to add the authentication script into my backup script. Could you point me into the direction where my script needs to go to get it working, please. ************Working authentication Script *********** $AdminName = "username" $Pass = Get-Content "C:\Masters

How to create a custom javascript pagination?

久未见 提交于 2021-01-29 05:25:09
问题 Hey guys am am working on a website and I have created a javascript pagination. Firstly please see my javascript and html. My Javascript const resultEl = document.querySelector('.allstatus'); const pageSize = document.querySelector('select[name="page-size"]'); const pageCurr = document.querySelector('input[name="page-curr"]') const resultCount = document.querySelector('.result-count') const pageNoCurr = document.querySelector('.page-no-curr'); const pageNoCount = document.querySelector('.page

Export SAP Data won't open workbook while running

六月ゝ 毕业季﹏ 提交于 2021-01-29 02:20:31
问题 I wrote a code to export data from SAP to an Excel workbook. To do that I open the transaction (IW28 in this case), export the file and save it to a specified location. When the file is opened, I want to copy the data from the exported sheet to my own sheet. The problem is that the exported sheet won't open while I'm running the macro. When I add a breakpoint in my code, the exported sheet opens when the macro stops. Without this breakpoint the exported sheets only opens after the macro had

Export SAP Data won't open workbook while running

喜夏-厌秋 提交于 2021-01-29 02:13:09
问题 I wrote a code to export data from SAP to an Excel workbook. To do that I open the transaction (IW28 in this case), export the file and save it to a specified location. When the file is opened, I want to copy the data from the exported sheet to my own sheet. The problem is that the exported sheet won't open while I'm running the macro. When I add a breakpoint in my code, the exported sheet opens when the macro stops. Without this breakpoint the exported sheets only opens after the macro had

Using global variables in a ps1

非 Y 不嫁゛ 提交于 2021-01-28 18:43:41
问题 I can't seem to find good enough solution to my problem. Is there a good way of grouping variables in some kind of file so that multiple scripts could access them? I've been doing some work with Desired State Configuration but the work that needs to be done cannot be efficiently implemented that way. The point is to install Azure Build Agent on a server and then to configure it. There are some variables that really should not be inside a script file just copypasted like Personal Access Token.

Convert to csv from json in powershell

我是研究僧i 提交于 2021-01-28 12:00:57
问题 this is my csv: "name,data Play,http://{gho}.domain.com/ BDomain,domain.com Charts,2 Compress,0 CompressJ,0" | ConvertFrom-Csv | ConvertTo-Json Gives me: [ { "name": "Play", "data": "http://{gho}.domain.com/" }, { "name": "BDomain", "data": "domain.com" }, { "name": "Charts", "data": "2" }, { "name": "Compress", "data": "0" }, { "name": "CompressJ", "data": "0" } ] I would now like to get that csv back from my json, however the chains of | ConvertFrom-Json | ConvertTo-CSV are not working, and

Match regex across multiple lines in bash

巧了我就是萌 提交于 2021-01-28 07:02:10
问题 I want to match all patterns that start with [% and end with %] in a file. I've tried multiple tools such as awk, sed, pcregrep and none of them seem to work, although they are suggested as top answers on similar questions. [% FOREACH selection = selections -%] case SELECTION_ID_[% SELECTION_NAME %]: { const [% selectionType %]& source = this->[% selectionName %](); rc = bcem_AggregateUtil::toAggregate(result, d_selectionId, source); } break; [% END -%] [% foo ] [% INCLUDE

Concatenate command string in a shell script

谁说胖子不能爱 提交于 2021-01-28 02:49:14
问题 I am maintaining an existing shell script which assigns a command to a variable in side a shell script like: MY_COMMAND="/bin/command -dosomething" and then later on down the line it passes an "argument" to $MY_COMMAND by doing this : MY_ARGUMENT="fubar" $MY_COMMAND $MY_ARGUMENT The idea being that $MY_COMMAND is supposed to execute with $MY_ARGUMENT appended. Now, I am not an expert in shell scripts, but from what I can tell, $MY_COMMAND does not execute with $MY_ARGUMENT as an argument.

Concatenate command string in a shell script

吃可爱长大的小学妹 提交于 2021-01-27 23:42:51
问题 I am maintaining an existing shell script which assigns a command to a variable in side a shell script like: MY_COMMAND="/bin/command -dosomething" and then later on down the line it passes an "argument" to $MY_COMMAND by doing this : MY_ARGUMENT="fubar" $MY_COMMAND $MY_ARGUMENT The idea being that $MY_COMMAND is supposed to execute with $MY_ARGUMENT appended. Now, I am not an expert in shell scripts, but from what I can tell, $MY_COMMAND does not execute with $MY_ARGUMENT as an argument.