How am I editting and running two different files?
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Because typing vim which test has created a file called which test presumably. Why did you type "vim which test" and not just "vim test"? The only problem with that theory is that you seem to infer typing "vim which test" brought up a file you could modify.
Because typing vim which test has created a file called which test presumably. Why did you type "vim which test" and not just "vim test"? The only problem with that theory is that you seem to infer typing "vim which test" brought up a file you could modify.
I just don't understand "vim which test".
Um, note the back-quotes around the which test meaning "the string returned by the the command."
As to the question asked by AncientPC, try a find ~/ | grep test to see if you have other copies of the test script laying around.
Um, note the back-quotes around the which test meaning "the string returned by the the command."
As to the question asked by AncientPC, try a find ~/ | grep test to see if you have other copies of the test script laying around.
Don't know what a back quote is, but I guess you mean the single inverted commas inside the dual ones. I had tried doing the same thing on scripts I had to see whether I could replicate it, but typing:
vim 'which myscriptname'
or:
vim which myscriptname
just opened up a blank vi session either named which or which myscriptname so I'd assumed the different styles of inverted commas were just for emphasis. Sorry for being thick.
Still don't understand it, what it's supposed to do and why I'm opening up black sessions.
Is the file needed to be named 'test' ?
Since it's a very generic name it could be calling different things when you run 'test' on command line, give it a try on 'which -a test' also 'env | grep test' to see if it has been redefined in your environment. Read bash man pages (you're using bash don't you?), I'm sure that has a builtin function named 'test' but I think it doesn't print anything
Don't know what a back quote is, but I guess you mean the single inverted commas inside the dual ones. I had tried doing the same thing on scripts I had to see whether I could replicate it, but typing:
vim 'which myscriptname'
or:
vim which myscriptname
just opened up a blank vi session either named which or which myscriptname so I'd assumed the different styles of inverted commas were just for emphasis. Sorry for being thick.
Still don't understand it, what it's supposed to do and why I'm opening up black sessions.
A backquote is the quote underneath the ~ key.
It basically evaluates what's between the ` ` before passing it on. For example, I could be redundant and type "ssh `whoami`@server.com" and it would evaluate to "ssh user@server.com" before running it.
Quote:
Originally Posted by fbianconi
Is the file needed to be named 'test' ?
Since it's a very generic name it could be calling different things when you run 'test' on command line, give it a try on 'which -a test' also 'env | grep test' to see if it has been redefined in your environment. Read bash man pages (you're using bash don't you?), I'm sure that has a builtin function named 'test' but I think it doesn't print anything
I've just renamed files for the sake of the forums. In reality, it's called rs-backup.sh and there is not another file that's named the same on the system but the same circumstances / problems apply as above.
Also, remember that test is a BASH "built-in" function, so writing your own executable called test may cause scripts that rely on the test built-in function may produce "unexpected" results.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.