LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Convert bat to .sh (https://www.linuxquestions.org/questions/linux-newbie-8/convert-bat-to-sh-890127/)

dinhnhan 07-05-2011 11:27 PM

Convert bat to .sh
 
I have code to download image on windows, but, i have a hosting linux, i want to run code on linux, but i dont know.Plz help me

PHP Code:

@echo off

set CUR_DIR
=%cd%
set PHPEXE=C:\php\php.exe
set PHPFILE
=%CUR_DIR%\downloadimages.php
set IGNORELISTFILE
=%CUR_DIR%\ignore_list.txt

rem PHPEXE PHPFILE Website_name Db_prefix Website_root DB_name Db_username Db_password Ignore_list_file_name
"%PHPEXE%" "%PHPFILE%" "" "sgm" "" "" "" "rooT@db1001" "%IGNORELISTFILE%" 


weibullguy 07-06-2011 12:16 AM

Don't know what shell you're using, but I wouldn't be surprised if it was BASH. In that case, start here --> http://tldp.org/LDP/abs/html/abs-guide.html

aysheaia 07-06-2011 01:13 AM

Something like that (if the PHP command line interface client is installed) :
Code:

#!/bin/bash
CUR_DIR="$(pwd)"
PHPEXE=php
PHPFILE="$(pwd)/downloadimages.php"
IGNORELISTFILE="$(pwd)/ignore_list.txt"
"${PHPEXE}" "${PHPFILE}" "" "sgm" "" "" "" "rooT@db1001" "${IGNORELISTFILE}"

Save this code in a file, make it executable (chmod 755 yourfilename) and put it where you have your downloadimages.php et ignore_list.txt files

John VV 07-06-2011 01:57 AM

that windows bat dose not download a photo
it runs the php file"downloadimages.php " -- we have no way of knowing what is in it
then passes the arguments "Website_name Db_prefix Website_root DB_name Db_username Db_password Ignore_list_file_name"
to the unknown "downloadimages.php " file to grab ( i am assuming)

these
DB_name, Db_username, Db_password

unless the site you run this against is OWNED by you
this might be illegal


All times are GMT -5. The time now is 11:57 AM.