scripting

Batch file with current date

别等时光非礼了梦想. 提交于 2020-01-17 00:07:29
问题 All, need a hlep in scripting in with batch file. I am very much new to scripting. I have an etl job which creates a file in a folder named as FINANCE20141011.txt. I need to create a batch file which will find current days file which is FINANCE20141011.txt (current date is 11/10/2014 and send the file to sftp server. There would be multiple file in the folder such as, FINANCE20141009.txt, FINANCE20141008.txt. But the script should pull up the current days file. Any help. Thanks. 回答1: @Echo

Socket communication?

≡放荡痞女 提交于 2020-01-16 08:44:34
问题 What are the preferred platforms to implement TCP socket communication? I'm interested in: scripting languages (eg Swocket for Python) and runtimes (eg .NET / Java). 回答1: In Java, we use Apache Mina, http://mina.apache.org/ Its performance rivals C implementation. 回答2: Socket communication implemented using Java NIO might be a good method. Some of Java based web servers use it. I remember jetty using it. Here is a link from Sun. 来源: https://stackoverflow.com/questions/1422929/socket

Send a sequence of commands to a new terminal from a script

空扰寡人 提交于 2020-01-16 07:42:28
问题 I have a script to which I wanna add a shutdown timer at the end, I'd like the countdown to run in a new terminal windows so I can cancel it since the script will usually be run in the background. Here's the problem, a simple script containing only the following secs=$((60)) while [ $secs -gt 0 ]; do echo -ne "$secs\033[0K\r" sleep 1 : $((secs--)) done shutdown now works fine, but if I try to send it to a new terminal like this gnome-terminal -e "bash -c 'secs=$((60)) while [ $secs -gt 0 ];

Why is my piping failing?

亡梦爱人 提交于 2020-01-16 02:12:10
问题 I've been messing around with .cmd scripts, and wanted to practice piping. I wrote one script to make files, and another to edit them with Notepad++. The making script (called create.cmd) is as follows: @echo off copy nul %1 > nul echo %1 And the edit script (called edit.cmd) is as follows: @echo off start notepad++.exe %1 Now, I wanted to try and make a file, and then pipe its output (hence the echo line) in the form of the name of the file to the edit script. So what I wrote was this:

How do I automate navigation to a website that requires authentication?

柔情痞子 提交于 2020-01-16 01:55:33
问题 Here's what I'm trying to achieve. I would like to write a script that will navigate to a website that requires me to be authenticated as myself, say Facebook, Live Spaces, Twitter or any other, and then have that script search for certain information on one of the pages of the website. I've done something similar in the past with the Windows.Forms WebBrowser control, which is a full blown implementation of IE that can be controlled through code and will store whatever cookies you get once

Crystal Reports & VBScript - Could Not Locate Automation Class

半城伤御伤魂 提交于 2020-01-15 13:11:04
问题 First off, I have very little Crystal Reports experience, so apologies in advance if this is a stupid question. I had this "fantastic" work project dumped on me when a co-worker left, so I'm hoping someone can help as most of the Business Objects links I find that might have solutions just redirect to a generic SAP splash page. So I have a few hundred Crystal Reports (mostly File Schema 10.2, although some are 8.5 or 12.0) that are stored on a server. All of them have an associated VBScript

Upload clocking script

谁说我不能喝 提交于 2020-01-15 11:45:06
问题 How can I make a script that, once a day, will upload a file via ftp to several different servers, then take note (in a log) of how much time the uploads took? Thanks to Rajax I have the cronjob set up to execute this so far as the script, let's say it's called ftpScript.sh: #!/bin/sh HOST='ftp.users.qwest.net' USER='MYUSERNAME' PASSWD='MYPASSWORD' FILE='filename.gif' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE quit END_SCRIPT exit 0 Where do I put this part? time

Bad substitution error in ksh [duplicate]

依然范特西╮ 提交于 2020-01-15 09:13:48
问题 This question already has answers here : Cannot debug simple ksh programme (2 answers) Closed 5 years ago . The following KornShell (ksh) script should check if the string is a palindrome. I am using ksh88 , not ksh93 . #!/bin/ksh strtochk="naman" ispalindrome="true" len=${#strtochk} i=0 j=$((${#strtochk} - 1)) halflen=$len/2 print $halflen while ((i < $halflen)) do if [[ ${strtochk:i:1} == ${strtochk:j:1} ]];then (i++) (j--) else ispalindrome="false" break fi done print ispalindrome But I am

Bad substitution error in ksh [duplicate]

廉价感情. 提交于 2020-01-15 09:13:22
问题 This question already has answers here : Cannot debug simple ksh programme (2 answers) Closed 5 years ago . The following KornShell (ksh) script should check if the string is a palindrome. I am using ksh88 , not ksh93 . #!/bin/ksh strtochk="naman" ispalindrome="true" len=${#strtochk} i=0 j=$((${#strtochk} - 1)) halflen=$len/2 print $halflen while ((i < $halflen)) do if [[ ${strtochk:i:1} == ${strtochk:j:1} ]];then (i++) (j--) else ispalindrome="false" break fi done print ispalindrome But I am

Bad substitution error in ksh [duplicate]

为君一笑 提交于 2020-01-15 09:12:32
问题 This question already has answers here : Cannot debug simple ksh programme (2 answers) Closed 5 years ago . The following KornShell (ksh) script should check if the string is a palindrome. I am using ksh88 , not ksh93 . #!/bin/ksh strtochk="naman" ispalindrome="true" len=${#strtochk} i=0 j=$((${#strtochk} - 1)) halflen=$len/2 print $halflen while ((i < $halflen)) do if [[ ${strtochk:i:1} == ${strtochk:j:1} ]];then (i++) (j--) else ispalindrome="false" break fi done print ispalindrome But I am