LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-11-2020, 08:00 PM   #1
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 20.04
Posts: 441

Rep: Reputation: 12
Howto run bash script from Window.location Href=


I am trying to run a bash script from a button click as so:

Code:
window.location.href='../databaseBak.sh';
This will not run the code.

What am I missing here? Do I need to write a PHP script that will exec(this code)??

THanks for help, R
 
Old 10-11-2020, 08:36 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,317
Blog Entries: 28

Rep: Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140Reputation: 6140
I'm hardly a coding expert, but "href" is an HTML attribute designed to call an HTML document, not a script. Also, by convention, the link is surrounded by double quotes, not single ones.

You may find this helpful: https://askubuntu.com/questions/1893...g-desktop-icon

Last edited by frankbell; 10-11-2020 at 08:43 PM.
 
Old 10-13-2020, 05:45 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,220

Rep: Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319
Quote:
Originally Posted by pizzipie View Post
Do I need to write a PHP script that will exec(this code)??
Yes
 
Old 10-13-2020, 06:34 PM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Quote:
Originally Posted by dugan View Post
Yes
no you just need to register shell scripts as executable scripts.

apache config:
AddHandler cgi-script .sh

link
<a href="/user-scripts/playmovie.sh">
 
  


Reply



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
JAVASCRIPT : using vars inside of onclick="window.location.href= ..... pizzipie Programming 2 10-04-2013 06:57 PM
LXer: Google I/O Android News: Location, Location, Location (Plus Cloud Messaging and Bluetooth) LXer Syndicated Linux News 0 06-05-2013 01:00 PM
window.location.href ShaqDiesel Programming 3 08-08-2012 01:04 PM
location, location, location! mermxx LQ Suggestions & Feedback 9 09-25-2004 03:08 AM
location.href behaviour on Linux? vonmugel Linux - General 0 07-22-2004 10:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:25 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration