Re: [Trisquel-users] Insert a character without typing it - Command Line *nix

2018-12-30 Thread facil12e

(Second part of the post)


But i still can use it in a scipt.

# ./test_file
this
is a
test ,

# cat test_file
#!/bin/sh
sh -c cat 


Re: [Trisquel-users] Insert a character without typing it - Command Line *nix

2018-12-30 Thread facil12e

Yes! I did it!

This does the job:

$ eval cat $(echo -e '\076') test_file


I remember reading about eval just a few days ago, and the role it play in a  
security bug in bash, because they where using eval a lot in the code and  
that ended up with file names or strings executed as code. Just exactly what  
i want.


Re: [Trisquel-users] Insert a character without typing it - Command Line *nix

2018-12-29 Thread facil12e

Ok, i will study those programs, thank you.

So, there are no way i can do it directly in the shell?


Re: [Trisquel-users] Insert a character without typing it - Command Line *nix

2018-12-29 Thread jason
Maybe look at remapping some other key combination. You can do it without any  
X stuff. Trisquel has the kbd package with programs like dumpkeys, showkey,  
and loadkeys. I encourage you to examine these.


Re: [Trisquel-users] Insert a character without typing it - Command Line *nix

2018-12-29 Thread facil12e
As i mention before it's a minimal system, no X, busybox sh and basically no  
internet acces.


Thank you, but that would not work for me. I already workaround this doing  
the following:


$ echo -e '\076' | less

then i press the 's' keys to save a log, which is the >. Then i edit the file  
with vi.


cat > test

I change the permissions

$ chmod +x my_file
$ ./my_file

I don't want to do that every time i need the characters < >
That's why i want to know if there is a method to put them in the  
prompt/terminal without saving them in a script.


I even try this:

$ exec cat $(echo -e '\076') my_file

exec it's beyond my knowledge, so i'm not sure of what i'm actually doing.


Re: [Trisquel-users] Insert a character without typing it - Command Line *nix

2018-12-29 Thread Mason Hock
> My question is: Is there any way to print a character and use it i as if
> it was introduced with the keyboard?

$ sudo apt install xdotool

And map "xdotool key <" to something. Executing that command will output
"<" as if you had typed it from the keyboard.


signature.asc
Description: PGP signature


[Trisquel-users] Insert a character without typing it - Command Line *nix

2018-12-29 Thread facil12e

Hi, English it's not my mother language, expect errors.

I have a laptop with a a broken keyboard, i have a US keyboard that i attach  
to the laptop to use it, but i don't use it with the US layout (i use the  
Spanish layout).


Anyway, sometimes i need to redirect stdin and stdout but i can't use < >  
(the redirections character), if i use Spanish layout in a US keyboard.  
Because i'm in a very limited shell with no X support, only kmaps and busybox  
sh.


My question is: Is there any way to print a character and use it i as if it  
was introduced with the keyboard?


I have tried doing this:

$ cat $(echo -e '\076') test.file
cat: >: No such file or directory
cat: test: No such file or directory

Thank you.