LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 07-29-2012, 03:31 PM   #1
esgol
Member
 
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Rep: Reputation: Disabled
Question Console: Can i create keyshortcuts for specific personal commands (e.g. ctr+3)


Programming g++.I cant stand it anymore switching with the up arrow for 1 of these 3 commands

>g++ code.cpp -o temp
>./temp
>clear

The 1st to compile, the 2nd to run, the 3rd to clear

Can i put the into key shortcutsa some way like ctrl+1

Maybe i can at least put in a shortcut 'clear' and maybe there is a combined command for the 2 others.

I'm on Kubuntu primaly and Debian secondly

EDIT: SOLUTION

Mix commands in one with &&
PHP Code:
clear && g++ code.cpp -o temp  && ./temp 
The above will run each command in turn, if the previous command exits without an error

Quote:
With clear last, you don't see the results -have to scroll up.
But put clear 1st:
1st screen is cleared
then compiled
then [ONLY IF compile suceded ] the exe runs

So if you have errors in code u'll se just those and you wont be bothered by having the previous stable version of the exe run.
Just, as casual command, seems to perfect fit for the need -like if designed specially for-, to be true
Comments:
Its even more convenient than Windows enviroments like VS or Dev!
( 1st ctrl+F5 - 2nd look down for errors - 3rd look up for console - which pops in diferent position/time )

Last edited by esgol; 07-30-2012 at 07:43 AM. Reason: Provided Solution
 
Old 07-29-2012, 10:57 PM   #2
kakaka
Member
 
Registered: Sep 2003
Posts: 382

Rep: Reputation: 87
If you typically do what could be described as:

1) g++ code.cpp -o temp
2) if step 1 succeeded, do step 3
3)./temp
4) if step 3 succeeded, do step 5
5) clear

maybe you could write a simple shell script to execute the commands, check the return codes, conditionally doing each next step if the return code is correct, then give the shell script a very short name, such as a name only two characters long.
 
1 members found this post helpful.
Old 07-29-2012, 11:15 PM   #3
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

you can put them all on one line. Eg
Code:
g++ code.cpp -o temp  && ./temp && clear
The above will run each command in turn, if the previous command exits without an error (just like kakaka describes).

HTH,

Evo2.
 
1 members found this post helpful.
Old 07-30-2012, 03:54 AM   #4
esgol
Member
 
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Talking Wooooooow its peerfeect!!!

WOOOOOOOW!!!!!!!!!!!!!!
LIFE GOT SO SIMPLEEEE!!!!!!!!!!!!!

Quote:
With clear last, i dont see the results -have to scroll up. But put clear 1st,
1st is cleared then compiled THEN ONLY IF ( ) COMPILE SUCEDED THE EXECUTABLE RUNS

PHP Code:
clear && g++ code.cpp -o temp  && ./temp 
ITS EVEN MORE CONVENIENT THAN WINDOWS! ( 1st ctrl+F5, 2nd look down for errors 3rd look up for console which pops in diferent positions its time UUUUUUUUUUUU!!!)

START TO LOVE THIS PENGUIN!!!!

THAAN YOUUUU SIRS!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert specific word into specific colors in console shell? arfal Linux - Server 3 05-10-2012 01:40 AM
Setting up user to use sudo for specific commands kreed Linux - Newbie 6 05-16-2011 05:43 PM
didn't find virtual text console ctr+alt+F1 like ? viji2ks Linux - Software 4 08-08-2005 09:03 AM
Commands to get some specific configuration gerargon Red Hat 3 07-20-2005 11:45 PM
Best way to put localized/personal commands kaon Slackware 1 11-07-2004 12:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration