3 edited the title
source | link

How can I choose one of locate's search`locate`'s results and let it be opened with a specified application

I have a bash script called findme, which is coded as follows:

#!/bin/bash
locate -Abi '*\.'$1 $2 | grep --color=always -ni $2 | less -R

It searches for me for all files with a specified file extension (first argument provided to the script) which has a pattern (the next provided argument) in its filename.
If I execute the following:

user@machine$ findme pdf classifi

It will search for all pdf files with classifi in its filename. So I may get something like the following result.

1:/home/user/Dropbox/SharedWithFriends/math/classifications2000.pdf
2:/home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

The question is: "Can you give me a bash script code in which after showing the results ask me for a number and a viewer, to automate my next job?"

for example I would like, if I enter:

> 2 evince

the script executes evince on the 2nd item of the search result, i.e., if this is what I entered on the previous search result it executes:

evince /home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

How can I choose one of locate's search results and let it be opened with a specified application

I have a bash script called findme, which is coded as follows:

#!/bin/bash
locate -Abi '*\.'$1 $2 | grep --color=always -ni $2 | less -R

It searches for me for all files with a specified file extension (first argument provided to the script) which has a pattern (the next provided argument) in its filename.
If I execute the following:

user@machine$ findme pdf classifi

It will search for all pdf files with classifi in its filename. So I may get something like the following result.

1:/home/user/Dropbox/SharedWithFriends/math/classifications2000.pdf
2:/home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

The question is: "Can you give me a bash script code in which after showing the results ask me for a number and a viewer, to automate my next job?"

for example I would like, if I enter:

> 2 evince

the script executes evince on the 2nd item of the search result, i.e., if this is what I entered on the previous search result it executes:

evince /home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

How can I choose one of `locate`'s results and let it be opened with a specified application

I have a bash script called findme, which is coded as follows:

#!/bin/bash
locate -Abi '*\.'$1 $2 | grep --color=always -ni $2 | less -R

It searches for me for all files with a specified file extension (first argument provided to the script) which has a pattern (the next provided argument) in its filename.
If I execute the following:

user@machine$ findme pdf classifi

It will search for all pdf files with classifi in its filename. So I may get something like the following result.

1:/home/user/Dropbox/SharedWithFriends/math/classifications2000.pdf
2:/home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

The question is: "Can you give me a bash script code in which after showing the results ask me for a number and a viewer, to automate my next job?"

for example I would like, if I enter:

> 2 evince

the script executes evince on the 2nd item of the search result, i.e., if this is what I entered on the previous search result it executes:

evince /home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf
2 deleted 4 characters in body; edited tags; edited title
source | link

How can I choose one of mylocate's search results and let it be opened with a providedspecified application

I have a bash script called findme, which is coded as follows:

#!/bin/bash
locate -Abi '*\.'$1 $2 | grep --color=always -ni $2 | less -R

It searches for me for all files with a specified file extentionextension (first argument provided to the script) which has a pattern (the next provided argument) in its filename.
If I execute the following:

user@machine$ findme pdf classifi

It will search for all pdf files with classifi in its filename. So I may get something like the following result.

1:/home/user/Dropbox/SharedWithFriends/math/classifications2000.pdf
2:/home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

The question is: "Can you I give myme a bash script code in which after showing the results ask me for a number and a viewer, to automate my next job?"

for example I would like, if I enter:

> 2 evince

the script executes evince on the 2nd item of the search result, i.e., if this is what I entered on the previous search result it executes:

evince /home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

How can I choose one of my search results and let it be opened with a provided application

I have a bash script called findme, which is coded as follows:

#!/bin/bash
locate -Abi '*\.'$1 $2 | grep --color=always -ni $2 | less -R

It searches for me for all files with a specified file extention (first argument provided to the script) which has a pattern (the next provided argument) in its filename.
If I execute the following:

user@machine$ findme pdf classifi

It will search for all pdf files with classifi in its filename. So I may get something like the following result.

1:/home/user/Dropbox/SharedWithFriends/math/classifications2000.pdf
2:/home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

The question is: "Can you I give my a bash script code in which after showing the results ask me for a number and a viewer, to automate my next job?"

for example I would like, if I enter:

> 2 evince

the script executes evince on the 2nd item of the search result, i.e., if this is what I entered on the previous search result it executes:

evince /home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

How can I choose one of locate's search results and let it be opened with a specified application

I have a bash script called findme, which is coded as follows:

#!/bin/bash
locate -Abi '*\.'$1 $2 | grep --color=always -ni $2 | less -R

It searches for me for all files with a specified file extension (first argument provided to the script) which has a pattern (the next provided argument) in its filename.
If I execute the following:

user@machine$ findme pdf classifi

It will search for all pdf files with classifi in its filename. So I may get something like the following result.

1:/home/user/Dropbox/SharedWithFriends/math/classifications2000.pdf
2:/home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

The question is: "Can you give me a bash script code in which after showing the results ask me for a number and a viewer, to automate my next job?"

for example I would like, if I enter:

> 2 evince

the script executes evince on the 2nd item of the search result, i.e., if this is what I entered on the previous search result it executes:

evince /home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf
1
source | link

How can I choose one of my search results and let it be opened with a provided application

I have a bash script called findme, which is coded as follows:

#!/bin/bash
locate -Abi '*\.'$1 $2 | grep --color=always -ni $2 | less -R

It searches for me for all files with a specified file extention (first argument provided to the script) which has a pattern (the next provided argument) in its filename.
If I execute the following:

user@machine$ findme pdf classifi

It will search for all pdf files with classifi in its filename. So I may get something like the following result.

1:/home/user/Dropbox/SharedWithFriends/math/classifications2000.pdf
2:/home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf

The question is: "Can you I give my a bash script code in which after showing the results ask me for a number and a viewer, to automate my next job?"

for example I would like, if I enter:

> 2 evince

the script executes evince on the 2nd item of the search result, i.e., if this is what I entered on the previous search result it executes:

evince /home/user/Dropbox/SharedWithFriends/math/classifications2010.pdf