Programming This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
06-21-2024, 05:19 AM
|
#1
|
Member
Registered: Jan 2024
Posts: 161
Rep:
|
How do I get rid of the whitespace in this script?
I just read up that xargs should get rid of it but it doesn't have any effect.
I bought an american keyboard but in the UK so often want to use the £ sign.
Code:
echo £|xargs|xclip -selection clipboard
The result still gives a space afterwards and maybe also a carriage return too.
How to get only the pound sign?
|
|
|
06-21-2024, 05:31 AM
|
#2
|
LQ Guru
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,506
|
There are several ways, but one would be to use the -n option with echo. The -e option might come in handy sometime also. As usual see, "man echo", or more likely "man bash" and scroll down to the section on echo.
Last edited by Turbocapitalist; 06-21-2024 at 05:33 AM.
|
|
1 members found this post helpful.
|
06-21-2024, 06:12 AM
|
#3
|
Member
Registered: Jan 2024
Posts: 161
Original Poster
Rep:
|
Quote:
Originally Posted by Turbocapitalist
There are several ways, but one would be to use the -n option with echo. The -e option might come in handy sometime also. As usual see, "man echo", or more likely "man bash" and scroll down to the section on echo.
|
Oh that is embarrassing as the answer is right there on the first page of the echo man! However I would have not thought to look at echo for the answer unless you said, even though I do quite often check man pages.
|
|
|
06-21-2024, 06:19 AM
|
#4
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,702
|
and what is even more annoying, this "man echo" is actually wrong, you need to inspect the man page of the shell (bash) and check how this echo command was implemented inside. (echo is a builtin, but available as an external command too). It is almost the same.
|
|
|
06-21-2024, 06:35 AM
|
#5
|
LQ Guru
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,506
|
Kind of and kind of not. The default is probably the one built in to the shell and the default shell is Bash but the manual page for that is a monster. It takes time and effort to learn to navigate the Bash manual page.
|
|
|
06-21-2024, 06:54 AM
|
#6
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,702
|
they are not the same, not identical, and that may lead to confusion. Suggesting an almost correct documentation is almost a good idea.
|
|
1 members found this post helpful.
|
06-21-2024, 06:57 AM
|
#7
|
Senior Member
Registered: Dec 2011
Location: Simplicity
Posts: 2,917
|
Also possible here:
Code:
printf £|xclip -selection clipboard
While in general there should be a format string for the printf:
Code:
printf "%s" 'any text here' | xclip -selection clipboard
Again, there is a shell-builtin and an external /usr/bin/printf tool.
Last edited by MadeInGermany; 06-21-2024 at 06:59 AM.
|
|
|
06-21-2024, 07:11 AM
|
#8
|
LQ Guru
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,506
|
Quote:
Originally Posted by pan64
they are not the same, not identical, and that may lead to confusion. Suggesting an almost correct documentation is almost a good idea.
|
Yes, there are a lot of built-in commands that are have stand-alone utilities with the same name, that is enough to cause confusion on its own. time is one I've recently noticed and for certain capabilities have to invoke the external tool with a backslash or the full path.
Code:
\time -f '%E %C' somescript
|
|
|
All times are GMT -5. The time now is 05:14 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|