LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-05-2011, 11:27 PM   #1
dinhnhan
LQ Newbie
 
Registered: Jul 2011
Posts: 1

Rep: Reputation: Disabled
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:phpphp.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%" 
 
Old 07-06-2011, 12:16 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,747
Blog Entries: 1

Rep: Reputation: 225Reputation: 225Reputation: 225
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
 
Old 07-06-2011, 01:13 AM   #3
aysheaia
LQ Newbie
 
Registered: Jun 2011
Distribution: Ubuntu
Posts: 26

Rep: Reputation: Disabled
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
 
Old 07-06-2011, 01:57 AM   #4
John VV
Guru
 
Registered: Aug 2005
Posts: 13,090

Rep: Reputation: 1748Reputation: 1748Reputation: 1748Reputation: 1748Reputation: 1748Reputation: 1748Reputation: 1748Reputation: 1748Reputation: 1748Reputation: 1748Reputation: 1748
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
 
0 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Convert DOS bat file to shell script spiderdog Linux - Newbie 2 06-21-2010 02:54 PM
How to convert a batch file(.bat) to script file(.sh) manas_sem Programming 4 06-28-2007 12:10 PM
convert .bat / .csh file to .sh files massoo Programming 1 03-06-2006 06:10 PM
The Bat! designator Linux - Software 4 11-03-2003 01:54 PM
autoexe.bat genghis Linux - Newbie 4 03-14-2003 09:33 PM


All times are GMT -5. The time now is 02:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration