Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Macros automatically loaded up

  1. #1

    Default Macros automatically loaded up

    Looking for a way to write macros that load up with a Konsole session.

    I found a good reference for the bash commands.

    Thanks.

  2. #2
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Macros automatically loaded up

    On 08/06/2013 05:06 PM, andy77586 wrote:
    > Looking for a way to write macros that load up with a Konsole session.


    when you say macro, what do you mean?
    do you mean a bash script? or a service or what?

    in fact, just tell us what are you wanting to accomplish....because
    an automatically starting 'macro' is (most likely) not the answer to
    your wishes..

    --
    dd
    http://tinyurl.com/DD-Caveat
    http://tinyurl.com/DD-Complaints

  3. #3

    Default Re: Macros automatically loaded up

    andy77586 wrote:
    > -Looking for a way to write macros that load up with a Konsole session.
    >
    > I found a good reference for the bash commands.


    You're probably looking to put some code in your .bashrc

    And if you want it to be conditional on being inside a Konsole then
    you'll need to put the code inside an if statement that tests the
    terminal type.

  4. #4

    Default Re: Macros automatically loaded up

    I use Windows XP.

    I am sure OpenSuse has something equivalent.

    Going to a console can be accomplished by pre-loading commands in a buffer.

    This saves a boatload of typing repetitive commands.

    For ex.

    cop2 copy $1 $2 is one macro.

    From a console, typing cop2 *.txt clinux would copy all text files in the current directory to the linux directory.

    You can have around 20 "commands" in memory for use.

    Andy

  5. #5

    Default Re: Macros automatically loaded up

    I don't know why the icon is there. I typed
    Code:
    ''c:\"

  6. #6
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,037

    Default Re: Macros automatically loaded up

    On Wed, 07 Aug 2013 00:56:04 +0000, andy77586 wrote:

    > I don't know why the icon is there. I typed Code:
    > --------------------
    > ''c"
    > --------------------


    Linux isn't Windows - it doesn't understand Windows pathnames.

    What you want to do is create a shell script, it sounds like - comparable
    to a batch file on Windows.

    Bash shell programming is an entire language unto itself (just like
    Powershell is on Windows). Have a look for the online bash shell
    programming primers, that should get you started.

    As I recall, there's a good one at the Linux Documentation Project:

    http://tldp.org/LDP/Bash-Beginners-Guide/html/

    Jim



    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Macros automatically loaded up

    On 2013-08-07 03:34, Jim Henderson wrote:
    > On Wed, 07 Aug 2013 00:56:04 +0000, andy77586 wrote:
    >
    >> I don't know why the icon is there. I typed Code:
    >> --------------------
    >> ''c"
    >> --------------------

    >
    > Linux isn't Windows - it doesn't understand Windows pathnames.


    I think he may be seeing a smiley instead, on web side ;-)


    > What you want to do is create a shell script, it sounds like - comparable
    > to a batch file on Windows.


    Or an alias. If you type "alias" in a terminal, you see a lot of things
    that when typed get replaced with others - which is what he describes.

    For example this one:

    Code:
    alias dir='ls -l'
    makes that typing "dir" produces a directory listing, when "dir" is not
    a linux command.

    It can be understood as terminal macros :-)

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4, with Evergreen, x86_64 "Celadon" (Minas Tirith))

  8. #8
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,037

    Default Re: Macros automatically loaded up

    On Wed, 07 Aug 2013 02:14:36 +0000, Carlos E. R. wrote:

    > On 2013-08-07 03:34, Jim Henderson wrote:
    >> On Wed, 07 Aug 2013 00:56:04 +0000, andy77586 wrote:
    >>
    >>> I don't know why the icon is there. I typed Code:
    >>> --------------------
    >>> ''c"
    >>> --------------------

    >>
    >> Linux isn't Windows - it doesn't understand Windows pathnames.

    >
    > I think he may be seeing a smiley instead, on web side ;-)


    Yeah, I see that - but more importantly, though, as a DOS pathname, Linux
    wouldn't understand it regardless.

    >> What you want to do is create a shell script, it sounds like -
    >> comparable to a batch file on Windows.

    >
    > Or an alias. If you type "alias" in a terminal, you see a lot of things
    > that when typed get replaced with others - which is what he describes.
    >
    > For example this one:
    >
    >
    Code:
    > alias dir='ls -l'
    >
    >
    > makes that typing "dir" produces a directory listing, when "dir" is not
    > a linux command.
    >
    > It can be understood as terminal macros :-)


    Certainly, that's an option as well, but a depending on what he
    specifically wants to do, a script may be more appropriate. We need more
    info.

    Jim



    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

  9. #9
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Macros automatically loaded up

    On 08/07/2013 02:56 AM, andy77586 wrote:

    > I use Windows XP.


    the problem is that i've not used windows in so long i don't know
    what a person means when they say they want a 'macro'



    > I am sure OpenSuse has something equivalent.
    >
    > Going to a console can be accomplished by pre-loading commands in a
    > buffer.
    >
    > This saves a boatload of typing repetitive commands.


    so, what you describe sounds like a alias to me also....

    but, you can also so just press and release the up arrow and bash
    will step back in time through all the commands you have put in
    before...when you get to the one you want just press Enter..

    but, if you come to one which is only _close_ to what you want to
    use, then you can edit what you see, _then push the Enter..

    ok, i said it will step back though 'all' which not actually correct
    because it does have a max it holds in its memory....the default is a
    LOT more than 20, and you can set it to 'remember' what ever you want..

    AND, at the bash prompt press Ctrl+r and bash goes into it search
    backwards more, so type in something you remember in the command you
    want to use again, and bingo it will pop up, then press enter...or
    edit and then press enter..

    --
    dd


  10. #10
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Macros automatically loaded up

    On 2013-08-07 06:31, Jim Henderson wrote:
    > On Wed, 07 Aug 2013 02:14:36 +0000, Carlos E. R. wrote:



    >> I think he may be seeing a smiley instead, on web side ;-)

    >
    > Yeah, I see that - but more importantly, though, as a DOS pathname, Linux
    > wouldn't understand it regardless.


    Oh, absolutely, but he was giving an example of what he does in Windows.
    He says that there he can define a macro as:

    Code:
    cop2 copy $1 $2
    (name expansion) so that when he types:

    Code:
    cop2 *.txt c:\linux
    it would be expanded to:

    Code:
    copy *.txt c:\linux

    And in the second post he was wondering that he saw an icon instead of
    what he typed - because he did not use code tags - I guess, because I'm
    on nntp and off the network.

    (alias)

    >> It can be understood as terminal macros :-)

    >
    > Certainly, that's an option as well, but a depending on what he
    > specifically wants to do, a script may be more appropriate. We need more
    > info.


    See above :-)


    However... I'm not familiar with those Window macros. I don't know if
    they are interpreted by the shell, or by the terminal emulator. In
    linux, both aliases and scripts are interpreted by the shell, terminals
    are transparent.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4, with Evergreen, x86_64 "Celadon" (Minas Tirith))

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •