command

Ruby, run linux commands one by one, by SSH and LOG everything

谁说我不能喝 提交于 2019-12-09 04:44:49
问题 I want to write code in Ruby witch net::ssh that run commands one by one on remote linux machine and log everything (called command, stdout and stderr on linux machine). So I write function: def rs(ssh,cmds) cmds.each do |cmd| log.debug "[SSH>] #{cmd}" ssh.exec!(cmd) do |ch, stream, data| log.debug "[SSH:#{stream}>] #{data}" end end end For example if I want to create on remote linux new folders and file: "./verylongdirname/anotherlongdirname/a.txt", and list files in that direcotry, and find

How to get file name of an icon file in a folder for creating/updating desktop.ini for folder(s)?

岁酱吖の 提交于 2019-12-09 03:43:38
问题 I need help returning the file name of a file located in a folder. I have read other questions asked a few times and the answer seems to be: for /d %F in (*.*) do echo %~nxF Although this seems to work for everyone else, when I run this within a batch file it has an exception and states that '~nxF' is not expected at this time. What I am trying to do is create a batch file that will read the icon file name, then enter the specific information into desktop.ini and finally create that file with

run a command conditionally with netcat and grep

时光怂恿深爱的人放手 提交于 2019-12-09 01:21:43
问题 I need netcat to listen on incomming HTTP requests, and depending on the request, I need to run a script. So far I have this; netcat -lk 12345 | grep "Keep-Alive" So every time netcat recieves a package that contains a "keep-alive", I need to fire a script. It needs to run in the crontab... Thanks for your help! 回答1: How about this? #!/bin/bash netcat -lk -p 12345 | while read line do match=$(echo $line | grep -c 'Keep-Alive') if [ $match -eq 1 ]; then echo "Here run whatever you want..." fi

How do I do a “word count” command in Windows Command Prompt

夙愿已清 提交于 2019-12-08 17:20:43
问题 I know the command in Unix/Linux systems is "wc" but that doesn't work in Windows. 回答1: The closest I know of is the PowerShell equivalent Measure-Object. 回答2: find command could be used in windows cmd to find line count (with the /c switch), word count etc. http://rickardnobel.se/counting-lines-in-windows-command-prompt/ 回答3: "Find" will be able to do the task similar to word count as RRM told. Eg. Query user | find /v /c "" /v – Show any lines that don’t contain the string of words you

RStudio Run command running twice issue [duplicate]

ぃ、小莉子 提交于 2019-12-08 16:22:48
问题 This question already has answers here : Rstudio is duplicating commands in the command line (4 answers) Closed 2 years ago . I have been having an odd issue with RStudio. When I use any command to run the script (so either Ctrl + R, Ctrl + Enter, or the actual Run command on RStudio) that command is run twice. I have been unable to find anything about this on the internet. Has any of you ever come across this issue? Thanks 回答1: I restart RStudio. Change to another workspace and come back.

Why are the datagrid delete command buttons disabled?

大兔子大兔子 提交于 2019-12-08 12:44:37
问题 I have a DataGrid where each row has a delete button. If I set the Command="Delete" attribute on the Delete button element in XAML, the button is disabled at runtime. Why?? XAML: <Page x:Class="AxureExport.TargetPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace

'C:\Users\' is not recognized as an internal or external command,operable program or batch file

南楼画角 提交于 2019-12-08 12:23:00
问题 i have this error in building in atmel studio 6 : C:\Program Files\Atmel\Atmel Studio 6.1\shellUtils\make.exe all 'C:\Users\' is not recognized as an internal or external command, operable program or batch file. 回答1: The entire string you show needs to be in quotes. Unfortunately you did not show any code... so we are left to guess. 1. It may appear as a string where it is used. 2. More likely you have something like this: set SomeVariable=C:\Program Files\Atmel\Atmel Studio 6.1\shellUtils

Making Calls through Android phone via bluetooth enabled micro controller

本秂侑毒 提交于 2019-12-08 12:18:48
问题 my end goal is have a microcontroller with bluetooth make calls through any bluetooth enabled phone via bluetooth. I currently have an android phone and it would be great if i could place calls onto that, but i am willing to purchase any phone. This is for my senior design and i have a lack of knowledge when it comes to the guts of cell phones. I currently can talk from my microcontroller to an Android app called BlueTerm, which is just a terminal for bluetooth, so i know the micro side is

Obtain the command line from a running process from the Command Prompt [closed]

笑着哭i 提交于 2019-12-08 12:13:29
问题 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 8 years ago . I wanted to determine the command-line arguments of a running process at the Command Prompt ( cmd.exe ). E.g., if I started my abc.exe program as follows: abc -d I want to determine the whole command line later. The TASKLIST utility does not provide this info, because it just reports the exe name and not the

Using cmd.exe from C#

こ雲淡風輕ζ 提交于 2019-12-08 11:44:27
问题 I have been toying with the Process class in C#. I have some code below I'd like to use to open cmd.exe and run the DIR command. However, when I attempt to use the code, the cmd.exe opens, but no command is run. Why is this happening and how do I fix it? Process cmd = new Process(); cmd.StartInfo.FileName = @"cmd.exe"; cmd.StartInfo.Arguments = @"DIR"; cmd.Start(); cmd.WaitForExit(); 回答1: Try passing the /K option to let the command console stay at video and receive the subsequent DIR command