You are not logged in.

#1 2016-03-19 23:15:58

chicknfangz
Member
Registered: 2016-03-19
Posts: 24

Basic Script help needed

Mod edit - split from Simple Google Searcher

photonucleon wrote:

Original thread: http://crunchbang.org/forums/viewtopic.php?pid=336542

Thought I'd just pop this in here, as I still use this all the time. This version is slightly different from the one in the thread linked above, in that it uses dash, not bash.

The idea here is to get the amount of time from beginning a web search to seeing the results down to as little as possible - so rather than launch a browser, wait for it to load up, navigate to the search bar or the google site or whatever, type your search query, and then wait while the results load up, this lets you instead type your search query almost instantly, and then the process of launching the browser and displaying the results is automated, and as a result just that little bit faster. I added a shortcut key (Win+G) for it in my Openbox config file for quick launching.

#!/bin/dash
gsearch="$(zenity --entry --title='Google Search' --text='Search:')"
if [ -z $gsearch ]
	then
		exit
else
	x-www-browser "http://www.google.co.uk/search?q=$gsearch"
fi
exit

How do i use this. I'm not a coder or anything so can anybody help me on what the instructions are please

Thank you

Last edited by damo (2016-03-20 02:51:50)

Offline

#2 2016-03-20 00:20:26

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Basic Script help needed

chicknfangz wrote:

....

How do i use this. I'm not a coder or anything so can anybody help me on what the instructions are please

Thank you

I suggest you find out a little about how to use a shell script - there are LOTS of websites with tutorials etc. Basically you copy the code above into a textfile (but you may have to use `bash` instead of `dash`, which is the shell used by BL), make it executable and save it in your $PATH ( I usually use ~/bin). It can then be run by just entering the name on the commandline, or in the Alt-F2 run box, or from the Alt-F3 menu.

If any of the terms I have just used are unfamiliar to you then you need to do some basic research wink


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2016-03-20 00:39:57

chicknfangz
Member
Registered: 2016-03-19
Posts: 24

Re: Basic Script help needed

Thanks demo. I'm not good with scripts not good with bash. I'm not a coder or a script maker.

So i will try this in virtualbox first. just in case something goes wrong. Can you help me in the right direction to links to the most easy and understanding on how to do this. not sure what to type in or what tutorials to get started for something like this shown above.

Thank you

Offline

#4 2016-03-20 00:54:26

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Basic Script help needed

If you can copy and paste then you are a "script maker" - you don't need to be able to write code.  But you DO need to familiarise yourself with basic terminology, and using a terminal.

I'm not going to do your searching for you, because I don't know what you don't know, but here is one to get you started:
http://linuxcommand.org/

NB This forum section is for working scripts and discussions, not basic help, so if you have specific questions, then would you open new topics for them in "Basic Help & Support"? Thanks smile

Last edited by damo (2016-03-20 02:52:48)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#5 2016-03-20 01:46:06

chicknfangz
Member
Registered: 2016-03-19
Posts: 24

Re: Basic Script help needed

damo wrote:

If you can copy and paste then you are a "script maker" - you don't need to be able to write code.  But you DO need to familiarise yourself with basic terminology, and using a terminal.

I'm not going to do your searching for you, because I don't know what you don't know, but here is one to get you started:
http://linuxcommand.org/

NB This forum section is for working scripts and discussions, not basic help, so if you have specific questions, then would you open new topics for them in "Basic Help & Support"? Thanks smile

I do know how to use the terminal. I use it for github. and i install Arch OS an i know the basics. But other then script making and bash stuff i i'm unfamiliar with. I also run debain and know the basic commands for terminal. so i do know quite a lot. But when it comes to scripts and bash. nope. But this is besides the point anyway thanks for your help. I will look at the link you provided and see what i can do

Offline

#6 2016-03-20 02:04:23

chicknfangz
Member
Registered: 2016-03-19
Posts: 24

Re: Basic Script help needed

Can anybody else help me to know how to do this please. and give me a good tutorial

That link wasn't very helpful demo there was nothing on that page about how to do this


Please respect me as a new user and give me good help. Thank you. as i will walk you though on how to do something with proper instructions step by step back. or i will simple ignore your comments thank you

Offline

#7 2016-03-20 02:11:43

Eraph
Member
From: /au/qld/bne
Registered: 2016-02-29
Posts: 282
Website

Re: Basic Script help needed

The thing about Linux, and the likes of BunsenLabs especially, is that you're generally expected to be a bit hands on. You should learn to embrace the terminal. If it intimidates you, you should consider a distro such as Ubuntu or Mint.
To use this script is not a matter of coding, but copying what has already been coded into a file, the location of which damo has already mentioned, make it executable (you can do this by right-clicking the file and going to properties), and then running it, again following his instructions.


Lenovo IdeaPad Yoga 13 | BunsenLabs Hydrogen (x64)
Intel Core i7-3537U | Intel HD4000 | 8GB DDR3 | 256GB SSD

Offline

#8 2016-03-20 02:43:02

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Basic Script help needed

chicknfangz wrote:

....
Please respect me as a new user and give me good help. Thank you. as i will walk you though on how to do something with proper instructions step by step back. or i will simple ignore your comments thank you

In that case, please respect the forums, and a moderator's request...

damo wrote:

NB This forum section is for working scripts and discussions, not basic help, so if you have specific questions, then would you open new topics for them in "Basic Help & Support"? Thanks

As @Eraph repeated, I did tell you what you needed to do to create and run a bash script. But you can of course ignore any help offered....


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#9 2016-03-20 02:43:08

chicknfangz
Member
Registered: 2016-03-19
Posts: 24

Re: Basic Script help needed

Eraph wrote:

The thing about Linux, and the likes of BunsenLabs especially, is that you're generally expected to be a bit hands on. You should learn to embrace the terminal. If it intimidates you, you should consider a distro such as Ubuntu or Mint.
To use this script is not a matter of coding, but copying what has already been coded into a file, the location of which damo has already mentioned, make it executable (you can do this by right-clicking the file and going to properties), and then running it, again following his instructions.


Has nothing to do with distribution. such as Ubuntu Mint. Debian Arch. i have used them all and know them well.


Its that demo did not give proper instructions. I know how to use terminal and know how to execute file and paste it in thats not problem. its after that where needs to explain what to to do. with good instructions for the file at hand. Now i get that some stuff needs to be looked up  and into every distro is like that. which is fine.


I found this which is very good instructions. That should have been giving on this file and is my point to good help

https://www.howtoforge.com/tutorial/lin … g-lessons/

But that is not the file that we are dealing with here right now. And should be given the proper instructions for this file

Thank you

Offline

#10 2016-03-20 02:46:56

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Basic Script help needed

chicknfangz wrote:

....
Its that demo did not give proper instructions. I know how to use terminal and know how to execute file and paste it in thats not problem. its after that where needs to explain what to to do. with good instructions for the file at hand. Now i get that some stuff needs to be looked up  and into every distro is like that. which is fine.

damo wrote:

you copy the code above into a textfile (but you may have to use `bash` instead of `dash`, which is the shell used by BL), make it executable and save it in your $PATH ( I usually use ~/bin). It can then be run by just entering the name on the commandline, or in the Alt-F2 run box, or from the Alt-F3 menu

How was this inadequate?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#11 2016-03-20 03:27:39

chicknfangz
Member
Registered: 2016-03-19
Posts: 24

Re: Basic Script help needed

damo wrote:
chicknfangz wrote:

....
Its that demo did not give proper instructions. I know how to use terminal and know how to execute file and paste it in thats not problem. its after that where needs to explain what to to do. with good instructions for the file at hand. Now i get that some stuff needs to be looked up  and into every distro is like that. which is fine.

damo wrote:

you copy the code above into a textfile (but you may have to use `bash` instead of `dash`, which is the shell used by BL), make it executable and save it in your $PATH ( I usually use ~/bin). It can then be run by just entering the name on the commandline, or in the Alt-F2 run box, or from the Alt-F3 menu

How was this inadequate?


Sorry i'm not trying to say this is on you for better instructions. obviously the person who posted it should have done the proper instructions. But anybody that gives help should give proper instructions including myself. If you needing he3lp with something or told how to do it i would tell you how.


The part that you lost me was right here.

save it in $PATH ( I usually use ~/bin). It can then be run by just entering the name on the commandline, or in the Alt-F2 run box, or from the Alt-F3 menu

Where do i save it to can i save it anywhere i like

then when i run it. say I'm in terminal now do i run it like this

chicknfangz$ google search
or
chicknfangz$ ./google search
or
chicknfangz$ ./google search.sh

And i have no idea what this is
or in the Alt-F2 run box, or from the Alt-F3 menu

is this something that is pressed from terminal in bunsenlabs OS

Thank you

Offline

#12 2016-03-20 04:16:21

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Basic Script help needed

chicknfangz wrote:

.... obviously the person who posted it should have done the proper instructions....

I think it is assumed that anyone reading it would have some basic knowledge already

The part that you lost me was right here.

save it in $PATH ( I usually use ~/bin). It can then be run by just entering the name on the commandline, or in the Alt-F2 run box, or from the Alt-F3 menu

Where do i save it to can i save it anywhere i like

Which is why I said

If any of the terms I have just used are unfamiliar to you then you need to do some basic research

If you save a script in your $PATH (look it up) then you can run a command by just using its name

And i have no idea what this is
or in the Alt-F2 run box, or from the Alt-F3 menu

is this something that is pressed from terminal in bunsenlabs OS

Thank you

The first menu item is "Run Program" (`gmrun`). Clicking on that opens a run dialog, and you can type a command in there. It can also be started by Alt-F2.

The Alt menu (`dmenu`) can be started with Alt-F3 and shows all the commands in your $PATH.

is this something that is pressed from terminal in bunsenlabs OS

Yes. Are you using something different?

EDIT: You are using Ubuntu aren't you?

--------------------------------

Anyway, you don't need a script to do a quick web search...just open the run dialog and write your search term like this (replace "searchterm" with, er, your search term). The browser will open with the google search results.

g: searchterm

Last edited by damo (2016-03-20 04:23:22)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#13 2016-03-20 05:08:00

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Basic Script help needed

@ chicknfangz

Trust me, there is nothing wrong with asking questions, believe me. But you have to know how to approach a problem as well. Because you seems to be confused with the actual usage of the command line, variables and operations, doing some background research into how linux operates may be wise. Even if just the basics. I've spent many many many hours playing around reading up on the basics of CLI. No one is "not respecting" you, but you gotta do some of the leg work as well...plus in reality, it'll help you out in the long run. Something you look up and learn about it's workings can help you learn about something else later on..


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#14 2016-03-20 06:42:22

gako
Member
Registered: 2015-10-02
Posts: 241

Re: Basic Script help needed

Bah,  don't be discouraged chinkenfinger.
You could just make the script something like

#!/bin/dash
x-www-browser "http://www.google.co.uk/search?q=""$1"

save it in /home/chinkenfinger/bin/gsearch
then

chmod + x /home/chickenfinger/bin/gsearch

and you could run it in a terminal like

gsearch  "how to make pie"

you wouldn't even need zenity.  8)

Last edited by gako (2016-03-20 06:48:22)

Offline

Board footer

Powered by FluxBB