ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
i am trying to help a buch of guys edit files for gaming servers using questions user input then sed command but if they put a space into the sting it fails can any one help
echo "Please give server name "
read name
sed s/clan/$name/g server.cfg > cfg.cfg
if they dont type spaces its fine
as soon as say they type "clan server"
the script fails is there a way of letting them use spaces
as bit of a pain in the rear can only use one word or a long sentence with no spaces
Originally posted by rharris72 thanks such a simple answer and work boy do i feel stupid lol
Don't feel stupid, lots of people don't seem to know how to use quotes - they just throw them in until things seem to work. Time invested in learning how to use single and double quotes properly will repay you many times over in saved time when you get it right first time. As an example, see the difference in the following:
ok thanks do you also know how i can soft or hard link folders so i can have say one folder with main game files in and another with the links in to the folder plus the server.cfg file for there individual server
do you also know how i can soft or hard link folders so i can have say one folder with main game files in and another with the links in to the folder plus the server.cfg file for there individual server
lndir
Code:
NAME
lndir - create a shadow directory of symbolic links to another direc-
tory tree
SYNOPSIS
lndir [ -silent ] [ -ignorelinks ] [ -withrevinfo ] fromdir [ todir ]
DESCRIPTION
The lndir program makes a shadow copy todir of a directory tree
fromdir, except that the shadow is not populated with real files but
instead with symbolic links pointing at the real files in the fromdir
directory tree. This is usually useful for maintaining source code for
different machine architectures. You create a shadow directory con-
taining links to the real source, which you will have usually mounted
from a remote machine. You can build in the shadow tree, and the
object files will be in the shadow directory, while the source files in
the shadow directory are just symlinks to the real files.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.