Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: SamK on December 03, 2010, 02:32:25 PM
-
I'm trying to create a .desktop file that opens an aterm and displays some text from a file then remains open at a command prompt once the text is shown. The aterm manual provides some help, but I'm still left with a couple of problems.
aterm -geometry 125x40+0+0 -title WindowTitle -e cat /path/to/text/file.txt
opens aterm, does not display the text and immediately closes the aterm window.
Is there a way to keep the window open (an equivalent -hold in xterm)?
What is the construction of the command to display the text from the file?
-
less is more! ;D
(replace 'cat' by 'less')
-
Actually on second thought, if I wouldn't have to rely on base only, I would use e3 for that instead of less, saving memory (even with c2fs) and also looking better, IMHO.
-
What I am after is a method in which aterm remains open at a command prompt once the text is shown to enable input of commands. Using less the aterm window closes when less is closed.
-
My bad...
Seems I had overlooked the details of the first sentence :-\
-
Try creating a file that contains this:
cat /path/to/text/file
sh
Make the file executable (chmod +x filename), and then call this script from your aterm command.
-
@ixbrian: Wow, I've been wanting an easy way to do this to add extra program associations to my personal Fluff config file. Thanks! :D
Example: You want to be able to do hexdumps of any file from Fluff. Create the following as /home/tc/hexdump.sh:
#!/bin/sh
hexdump -C $1 | more
sh
Now the following can be added to the .fluff.conf file:
file, Hex, aterm -e /home/tc/hexdump.sh %s &
Now a paging hex dump for any file is only a few clicks away. ;)
--
Mike L.
-
Try creating a file that contains this:
cat /path/to/text/file
sh
Make the file executable (chmod +x filename), and then call this script from your aterm command.
Many thanks, that works well.
It has sparked a development of the idea...
Is it possible to create a .desktop file that opens an aterm in the manner now working, i.e. specifying the executable script but also appending the text file to the Exec line? Something like this
Exec=aterm param param param -e /path/to/executable/script.sh /path/to/text/file.txt
The idea being to have the executable script open the text file as %1.
I have tried with this executable script
cat %1
echo ; echo
sh
but it reports cannot find %1.
-
but it reports cannot find %1.
Try $1 instead of %1.
Brian
-
but it reports cannot find %1.
Try $1 instead of %1.
Brian
Once again thanks. This does exactly what I want. The two assists have helped produce a most useful result.
-
@ixbrian: Wow, I've been wanting an easy way to do this to add extra program associations to my personal Fluff config file. Thanks! :D
Example: You want to be able to do hexdumps of any file from Fluff. Create the following as /home/tc/hexdump.sh:
#!/bin/sh
hexdump -C $1 | more
sh
Now the following can be added to the .fluff.conf file:
file, Hex, aterm -e /home/tc/hexdump.sh %s &
Now a paging hex dump for any file is only a few clicks away. ;)
--
Mike L.
More wow!
Inspired by this thread I adapted the idea and implemented a hexdump pager to associate files with in rox filer on my system.
Once that worked I was encouraged, and with the same concept I respectively created a strings viewer which for me is more needed/desirable. :D
This seems to be one of those concepts which are way too simple for a single mind to come up with, thank you all who contributed.
-
Here's a link to a topic showing the way in which I applied the answers supplied. I find it very useful - again many thanks.
http://forum.tinycorelinux.net/index.php?topic=8015.msg43000#msg43000
-
If you just want it a one liner, you could do something like
aterm -e sh -c "cat file && exec sh"
-
If you just want it a one liner, you could do something like
aterm -e sh -c "cat file && exec sh"
Thanks for the idea. I have updated http://forum.tinycorelinux.net/index.php?topic=8015.msg43483#msg43483 as it does away with one of the extensions originally used.
With this refinement I was unable to ensure some distance between the end of the text file and the command prompt. In the original it was done by multiple echoes, but I could not find a way to make it work in the one-liner.
-
aterm -e sh -c "cat file && echo -e "\n\n" && exec sh"
-
Probably would need something else for the quotes, i.e.
aterm -e sh -c "cat file && echo -e '\n\n' && exec sh"
or like the earlier post with
aterm -e sh -c "cat file;echo;echo; exec sh"
-
aterm -e sh -c "cat file && echo -e "\n\n" && exec sh"
Thanks for the suggestion. Using double quotes around the newline characters produced nn. Replacing the double quotes with single quotes gave the desired result.
aterm -e sh -c "cat file && echo -e '\n\n' && exec sh"
Works as wanted.
This post was made at the same time as a similar reply from ^thehatsrule^
-
...or like the earlier post with
aterm -e sh -c "cat file;echo;echo; exec sh"
This works as wanted and have adopted it as I find it easier to read.
http://forum.tinycorelinux.net/index.php?topic=8015.msg43483#msg43483