scripting

Autohotkey alternative for Mac OS X? [closed]

ⅰ亾dé卋堺 提交于 2019-12-20 09:47:45
问题 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 4 years ago . This question has been asked before but with no answer. I'm running into brick walls with google too. Program can either be free or paid. 回答1: Keymando - $19, 30-day free trial. Uses Ruby as its scripting language. IronAHK will run AHK scripts, but for its GUI it requires X11.app. I don't believe it can automate

Programmatically extract tar.gz in a single step (on Windows with 7-Zip)

霸气de小男生 提交于 2019-12-20 09:27:48
问题 Problem: I would like to be able to extract tar.gz files in a single step. This makes my question almost identical to this one: Stack Overflow question for tar-gz. My question is almost the same, but not the same, because I would like to do this on windows using 7-Zip command-line (or something similar) inside a bat file or Ruby/Perl/Python script. Question: This seemingly simple task is proving to be more involved than the first appearance would make it out to be. Does anyone have a script

find -name “*.xyz” -o -name “*.abc” -exec to Execute on all found files, not just the last suffix specified

心已入冬 提交于 2019-12-20 09:15:06
问题 I'm trying to run find ./ -name "*.xyz" -o -name "*.abc" -exec cp {} /path/i/want/to/copy/to In reality it's a larger list of name extensions but I don't know that matters for this example. Basically I'd like to copy all those found to another /path/i/want/to/copy/to. However it seems to only be executing the last -name test in the list. If I remove the -exec portion all the variations of files I expect to be found are printed out. How do I get it to pass the full complement of files found to

find -name “*.xyz” -o -name “*.abc” -exec to Execute on all found files, not just the last suffix specified

十年热恋 提交于 2019-12-20 09:13:00
问题 I'm trying to run find ./ -name "*.xyz" -o -name "*.abc" -exec cp {} /path/i/want/to/copy/to In reality it's a larger list of name extensions but I don't know that matters for this example. Basically I'd like to copy all those found to another /path/i/want/to/copy/to. However it seems to only be executing the last -name test in the list. If I remove the -exec portion all the variations of files I expect to be found are printed out. How do I get it to pass the full complement of files found to

How do I create a directory on remote host if it doesn't exist without ssh-ing in?

久未见 提交于 2019-12-20 09:09:21
问题 I'm not sure if this is possible or not. Basically, I'm writing a script that allows me to scp a file to my hosting. This is it so far. Argument 1 is the file and argument 2 is the folder I want it to be placed in on the remote server: function upload { scp $1 myusername@ssh.myhost.net:$2 } As you may/may not know, if the directory I specify when I call the function doesn't exist, then the transfer fails. Is there a way to check if the directory exists in the function and if it doesn't,

How can I execute a series of commands in a bash subshell as another user using sudo?

落花浮王杯 提交于 2019-12-20 08:24:28
问题 I'm writing a bash script that needs to sudo multiple commands. I can do this: ( whoami ; whoami ) but I can't do this: sudo ( whoami ; whoami ) How do I solve this? 回答1: Run a shell inside sudo : sudo bash -c 'whoami; whoami' You can use any character except ' itself inside the single quotes. If you really want to have a single quote in that command, use '\'' (which technically is: end single-quote literal, literal ' character, start single-quoted literal; but effectively this is a way to

Using a Ruby script to login to a website via https

孤人 提交于 2019-12-20 08:19:03
问题 Alright, so here's the dealio: I'm working on a Ruby app that'll take data from a website, and aggregate that data into an XML file. The website I need to take data from does not have any APIs I can make use of, so the only thing I can think of is to login to the website, sequentially load the pages that have the data I need (in this case, PMs; I want to archive them), and then parse the returned HTML. The problem, though, is that I don't know of any ways to programatically simulate a login

Loop through filenames with spaces within a path

半腔热情 提交于 2019-12-20 07:45:11
问题 I wanted to pass the path name to the script, but my path has spaces (eg. /Users/netto/iTunes \Media/Music/). I have tried putting the actual path directly on the for loop, and I was able to get all the files. Unfortunately, I could not pass it as variable. I have tried both double quote, and single quote. This is what I have currently $PATH=$1 for f in $PATH; do echo "Processing file $f " done Please let me know on how to do this. Thank you in advance. 回答1: Spaces in variables are expanded

Creating Zip files using PowerShell

岁酱吖の 提交于 2019-12-20 07:23:14
问题 I have these below files at a location C:\Desktop\Mobile. Apple_iphone6.dat Apple_iphone7.dat Samsung_edge7.dat Samsung_galaxy.dat Sony_experia.dat Sony_M2.dat I need to create a script that writes the similar files into a single zip. So files Apple_iphone6.dat and Apple_iphone7.dat must be into single zip. So the final zip files created would be: Apple_Files_Timestamp.zip Samsung_Files_Timestamp.zip Sony_Files_Timestamp.zip I tried this Get-ChildItem C:\Desktop\Mobile -Recurse -File -Include

Return variable value from second powershell script to first PowerShell script?

大城市里の小女人 提交于 2019-12-20 06:38:44
问题 I created 1.ps1 script which calls 2.ps1 script. After calling 2.ps1 it give some result in $variable . I want this $variable result to be used in my 1.ps1 for manipulation. $csv = Get-Content \\10.46.198.141\try\windowserver.csv foreach ($servername in $csv) { $TARGET = $servername $ProfileName = "CustomPowershell" $SCRIPT = "powershell.exe -ExecutionPolicy Bypass -File '\\10.46.198.141\try\disk_space.ps1' '$servername'" $HubRobotListPath = "C:\Users\Automation\Desktop\hubrobots.txt"