How to start MSYS with arguments for the first command executed

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

How to start MSYS with arguments for the first command executed

nikola bozovic
My plan is to edit msys.bat file that is used for
lunching msys and mingw terminal.

Line that lunches that terminal is:

start %WD%sh --login -i

that works very nice, it opens blank unix like terminal.
I am working on windows XP, and msys.bat is 
processed from built in MS-DOS command prompt, aka cmd.exe.
command sh also accepts a lot of arrguments, and one of them is
-c whic is suposed to be followed by command for execution.
that works olso, but when i call 
sh -c "notepad" 
it opens notepad, but it does not change terminal. if i try
sh --login -i -c "notepad"
situation is the same. I need msys to load first and then to execute command.
if i write these two in msys bat it does nothin, just open and close terminal window.

i olso try numerous of combination but no luck.
Thanx for reading and if you know anyway to help, thank you

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to start MSYS with arguments for the first command executed

lrn-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30.03.2012 17:43, nikola bozovic wrote:
> I am working on windows XP, and msys.bat is processed from built in
> MS-DOS command prompt, aka cmd.exe. command sh also accepts a lot
> of arrguments, and one of them is -c whic is suposed to be followed
> by command for execution. that works olso, but when i call sh -c
> "notepad" it opens notepad, but it does not change terminal. if i
> try sh --login -i -c "notepad" situation is the same. I need msys
> to load first and then to execute command. if i write these two in
> msys bat it does nothin, just open and close terminal window.
This is quoted from bash manual:
> -c string Read and execute commands from string after processing
> the options, then exit. Any remaining arguments are assigned to the
> positional parameters, starting with $0.
That is, `-c' does exactly what it meant to do.

Now, to execute something on msys startup you can place a script with
.sh extension into ~/.profile.d/ directory (create it if it doesn't
exist). Shell will run every script in that directory every time you
run a login shell (i.e. with --login).
If you want this to be executed only for one startup, add a `rm' call
into that script file:
> cat ~/.profile.d/run_once.sh
#!/bin/sh
start notepad.exe
rm ~/.profile.d/run_once.sh

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPdcfFAAoJEOs4Jb6SI2Cw6zEH/jnnifJzPLW+bhe2X6865SK9
fGR69A3u6/KEnqzNbCsDC4xoJ4J/g53GXvXt060X6h1qzkgtfTrwWHGdUdaURKcj
fJhw2Ol4J+MCNWECQGR8fdWYgYhM3LCGg9pJFxQ97ih7bLR7WqhZgruzEHTjsYBr
sdn8N2V0Fr++ssrhqoKhNrq7R0OhiAAlhs9ENO3sSYDBiR42djSTnIe06pZYdghn
ebx+5Qr7jSYYOfyVPpasDkdAbjZYPdNr4Tupnkrh0l8uiErDcyzvuyyCk0KmHW6h
RyQfsM3QIpb5mD2ptFsscFtJblxYEirWyMVaypFvpU52txAVjdStzKKarNRuTM8=
=tUOf
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to start MSYS with arguments for the first command executed

Earnie Boyd
In reply to this post by nikola bozovic
On Fri, Mar 30, 2012 at 9:43 AM, nikola bozovic wrote:
> that works olso, but when i call
> sh -c "notepad"
> it opens notepad, but it does not change terminal. if i try
> sh --login -i -c "notepad"
> situation is the same. I need msys to load first and then to execute
> command.
> if i write these two in msys bat it does nothin, just open and close
> terminal window.
>

The proper way to do this is

$ start notepad

You can then add to your ~/.profile file

alias notepad='start nodepad'

After which

$ notepad foo.txt; #open a notepad session editing foo.txt.

--
Earnie
-- https://sites.google.com/site/earnieboyd

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to start MSYS with arguments for the first command executed

nikola bozovic
In reply to this post by nikola bozovic




>My plan is to edit msys.bat file that is used for
>lunching msys and mingw terminal.
>
>Line that lunches that terminal is:
>
>start %WD%sh --login -i
>
>that works very nice, it opens blank unix like terminal.
>I am working on windows XP, and msys.bat is 
>processed from built in MS-DOS command prompt, aka cmd.exe.
>command sh also accepts a lot of arrguments, and one of them is
>-c whic is suposed to be followed by command for execution.
>that works olso, but when i call 
>sh -c "notepad" 
>it opens notepad, but it does not change terminal. if i try
>sh --login -i -c "notepad"
>situation is the same. I need msys to load first and then to execute command.
>if i write these two in msys bat it does nothin, just open and close terminal window.
>
>i olso try numerous of combination but no luck.
>Thanx for reading and if you know anyway to help, thank you

There was 2 replays saying some solutions:
1.replace "notepad" with "start notepad" - it aint work, when i write this line in msys.bat 
it only opens another terminal window with no mingw loaded,
and notepad is not executed.
2.to edit .profile.d direktory, is mb good solution if i realy dont find any other.

--THANK  YOU AGAIN

BUT, what i need actualy? 
i want to set the windows to open a terminal window with mingw (msys.bat) loaded - UNIX like terminal - colored$
when i click on any text file. My plan is to pass he arguments from windows to msys.bat, 
and then fom msys.bat to pass the command including folowing arguments (%1)


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to start MSYS with arguments for the first command executed

nikola bozovic
In reply to this post by lrn-2
hi there,
thanx for your time and attencione,
i made one .sh script file in /~/.profile.d/
and it is not proccessed 
on msys initialization


From: LRN <[hidden email]>
To: [hidden email]
Sent: Friday, March 30, 2012 4:48 PM
Subject: Re: [Mingw-users] How to start MSYS with arguments for the first command executed

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30.03.2012 17:43, nikola bozovic wrote:
> I am working on windows XP, and msys.bat is processed from built in
> MS-DOS command prompt, aka cmd.exe. command sh also accepts a lot
> of arrguments, and one of them is -c whic is suposed to be followed
> by command for execution. that works olso, but when i call sh -c
> "notepad" it opens notepad, but it does not change terminal. if i
> try sh --login -i -c "notepad" situation is the same. I need msys
> to load first and then to execute command. if i write these two in
> msys bat it does nothin, just open and close terminal window.
This is quoted from bash manual:
> -c string Read and execute commands from string after processing
> the options, then exit. Any remaining arguments are assigned to the
> positional parameters, starting with $0.
That is, `-c' does exactly what it meant to do.

Now, to execute something on msys startup you can place a script with
.sh extension into ~/.profile.d/ directory (create it if it doesn't
exist). Shell will run every script in that directory every time you
run a login shell (i.e. with --login).
If you want this to be executed only for one startup, add a `rm' call
into that script file:
> cat ~/.profile.d/run_once.sh
#!/bin/sh
start notepad.exe
rm ~/.profile.d/run_once.sh

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPdcfFAAoJEOs4Jb6SI2Cw6zEH/jnnifJzPLW+bhe2X6865SK9
fGR69A3u6/KEnqzNbCsDC4xoJ4J/g53GXvXt060X6h1qzkgtfTrwWHGdUdaURKcj
fJhw2Ol4J+MCNWECQGR8fdWYgYhM3LCGg9pJFxQ97ih7bLR7WqhZgruzEHTjsYBr
sdn8N2V0Fr++ssrhqoKhNrq7R0OhiAAlhs9ENO3sSYDBiR42djSTnIe06pZYdghn
ebx+5Qr7jSYYOfyVPpasDkdAbjZYPdNr4Tupnkrh0l8uiErDcyzvuyyCk0KmHW6h
RyQfsM3QIpb5mD2ptFsscFtJblxYEirWyMVaypFvpU52txAVjdStzKKarNRuTM8=
=tUOf
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe



------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to start MSYS with arguments for the first command executed

lrn-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02.04.2012 14:18, nikola bozovic wrote:

> On Friday, March 30, 2012 4:48 PM LRN wrote:
>> On 30.03.2012 17:43, nikola bozovic wrote:
>>> I am working on windows XP, and msys.bat is processed from
>>> built in MS-DOS command prompt, aka cmd.exe. command sh also
>>> accepts a lot of arrguments, and one of them is -c whic is
>>> suposed to be followed by command for execution. that works
>>> olso, but when i call sh -c "notepad" it opens notepad, but it
>>> does not change terminal. if i try sh --login -i -c "notepad"
>>> situation is the same. I need msys to load first and then to
>>> execute command. if i write these two in msys bat it does
>>> nothin, just open and close terminal window.
>> This is quoted from bash manual:
>>> -c string Read and execute commands from string after
>>> processing the options, then exit. Any remaining arguments are
>>> assigned to the positional parameters, starting with $0.
>> That is, `-c' does exactly what it meant to do.
>>
>> Now, to execute something on msys startup you can place a script
>> with .sh extension into ~/.profile.d/ directory (create it if it
>> doesn't exist). Shell will run every script in that directory
>> every time you run a login shell (i.e. with --login). If you want
>> this to be executed only for one startup, add a `rm' call into
>> that script file:
>>> cat ~/.profile.d/run_once.sh
>> #!/bin/sh start notepad.exe rm ~/.profile.d/run_once.sh
> hi there, thanx for your time and attencione, i made one .sh script
> file in /~/.profile.d/ and it is not proccessed on msys
> initialization

Ah, sorry, my bad. I forgot that this is not a standard feature.
Create a ~/.profile file (if it doesn't exist) and put this into it:

for i in ~/.profile.d/*.sh ; do
  if [ -f $i ]; then
    . $i
  fi
done
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPeZ7LAAoJEOs4Jb6SI2Cwe5IIANvXTK72BfqXzK6h1z4pKpqr
rN2UdtImUnTDwv2ES0JK2MEYB8redcSzCStPBjxEzO4j3Zm4QGaL8zUymmS6KXj2
B1EB2iH6ZGfdfY4j98Zrk4mDaX4SbNbx+jnzuiu2F/IJailmKKpN1pWLAYjpLBX6
dU13w/dmzdX0D1QIw6hI1OL7fXtriBRe4snktkuvl4kkzXrz38LuJ6greP4owKar
j2YEkz+7uQSl4kOKwbkyWRhI0YmwSDbKccXLadxYE4GuLPARqE2XLxBkDffQErzY
/7jlCQfsWPFD9gLA8vTx5xemzL/JdO6IXnTpX0kTeenI+cewnfOSt+9ccE96AcY=
=KGz6
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to start MSYS with arguments for the first command executed

Earnie Boyd
In reply to this post by nikola bozovic
On Mon, Apr 2, 2012 at 4:12 AM, nikola bozovic wrote:
>
> There was 2 replays saying some solutions:
> 1.replace "notepad" with "start notepad" - it aint work, when i write this
> line in msys.bat

Do not modify msys.bat, you will be upset when you update MSYS.  The
``start notepad'' is for the command line.  The ``alias nodepad='start
notepad''' is to be put into your ~/.profile file.  The start command
is itself a UNIX script file ``cat /bin/start'' so executing it from
within msys.bat isn't going to work.

> it only opens another terminal window with no mingw loaded,
> and notepad is not executed.
> 2.to edit .profile.d direktory, is mb good solution if i realy dont find any
> other.
>
> --THANK  YOU AGAIN
>
> BUT, what i need actualy?
> i want to set the windows to open a terminal window with mingw (msys.bat)
> loaded - UNIX like terminal - colored$
> when i click on any text file. My plan is to pass he arguments from windows
> to msys.bat,
> and then fom msys.bat to pass the command including folowing arguments (%1)

I don't get how notepad comes into play here.  What do you want the
modified batch file to do?  Again, you do not want to modify msys.bat
since you will be upset when you update MSYS.  A copy of it maybe but
then you'll need to compare any future releases for modifications.

--
Earnie
-- https://sites.google.com/site/earnieboyd

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to start MSYS with arguments for the first command executed

Earnie Boyd
In reply to this post by lrn-2
On Mon, Apr 2, 2012 at 8:42 AM, LRN wrote:
>
> Ah, sorry, my bad. I forgot that this is not a standard feature.
> Create a ~/.profile file (if it doesn't exist) and put this into it:
>
> for i in ~/.profile.d/*.sh ; do
>  if [ -f $i ]; then
>    . $i
>  fi
> done

Or perhaps use /etc/profile.d which is processed by /etc/profile during --login.

--
Earnie
-- https://sites.google.com/site/earnieboyd

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to start MSYS with arguments for the first command executed

lrn-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02.04.2012 17:12, Earnie Boyd wrote:

> On Mon, Apr 2, 2012 at 8:42 AM, LRN wrote:
>>
>> Ah, sorry, my bad. I forgot that this is not a standard feature.
>> Create a ~/.profile file (if it doesn't exist) and put this into
>> it:
>>
>> for i in ~/.profile.d/*.sh ; do if [ -f $i ]; then . $i fi done
>
> Or perhaps use /etc/profile.d which is processed by /etc/profile
> during --login.
>
/etc/profile is a system-wide configuration, while ~/.profile is a
user-level one. For example, it won't be read if the shell was started
in non-login mode, so using it for that sort of things (though i'm
still struggling to understand what exactly the OP wanted) is safer
than /etc/profile
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPefjRAAoJEOs4Jb6SI2CwPfkH/2XTdMHC8LLJ1R2WtRKm5rmc
Sh+5RP4teenPnrh0iq80mDlyKLNj9CI6K+1G75D4gsIyocK3/zxQm6uoa0seT+uX
xmaxpU4R+yIz5O/j5Rz83AL+pTIrndRT0KtNGPvZbjH/f70nOlExwum5b7bMZkee
NK+eqKfo5UGGq2+TR9wb68EPb+HxoDp2lyQeBTE7NUwWaaAIqtDnBwQQoXer4GIb
Hgeoo3Gmqw5mto8ytDHdMEPJlvIp1Vt6SBdS4T/yhQfqNalXDdXfyYDhiuSfkPiZ
blc1Td5/UPoU0ddFn/y5gE3hqxSZjfOYUfXQoiMZZhGOlnpEd+ZymJI7nNe3FmM=
=dFli
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to start MSYS with arguments for the first command executed

Marissa McDowell
In reply to this post by lrn-2
Hi were you able to come up with a solution to this problem?  I am trying to accomplish a similar task and have not had any luck.
On Friday, March 30, 2012 10:48:37 AM UTC-4, LRN wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30.03.2012 17:43, nikola bozovic wrote:
> I am working on windows XP, and msys.bat is processed from built in
> MS-DOS command prompt, aka cmd.exe. command sh also accepts a lot
> of arrguments, and one of them is -c whic is suposed to be followed
> by command for execution. that works olso, but when i call sh -c
> "notepad" it opens notepad, but it does not change terminal. if i
> try sh --login -i -c "notepad" situation is the same. I need msys
> to load first and then to execute command. if i write these two in
> msys bat it does nothin, just open and close terminal window.
This is quoted from bash manual:
> -c string Read and execute commands from string after processing
> the options, then exit. Any remaining arguments are assigned to the
> positional parameters, starting with $0.
That is, `-c' does exactly what it meant to do.

Now, to execute something on msys startup you can place a script with
.sh extension into ~/.profile.d/ directory (create it if it doesn't
exist). Shell will run every script in that directory every time you
run a login shell (i.e. with --login).
If you want this to be executed only for one startup, add a `rm' call
into that script file:
> cat ~/.profile.d/run_once.sh
#!/bin/sh
start notepad.exe
rm ~/.profile.d/run_once.sh

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPdcfFAAoJEOs4Jb6SI2Cw6zEH/jnnifJzPLW+bhe2X6865SK9
fGR69A3u6/KEnqzNbCsDC4xoJ4J/g53GXvXt060X6h1qzkgtfTrwWHGdUdaURKcj
fJhw2Ol4J+MCNWECQGR8fdWYgYhM3LCGg9pJFxQ97ih7bLR7WqhZgruzEHTjsYBr
sdn8N2V0Fr++ssrhqoKhNrq7R0OhiAAlhs9ENO3sSYDBiR42djSTnIe06pZYdghn
ebx+5Qr7jSYYOfyVPpasDkdAbjZYPdNr4Tupnkrh0l8uiErDcyzvuyyCk0KmHW6h
RyQfsM3QIpb5mD2ptFsscFtJblxYEirWyMVaypFvpU52txAVjdStzKKarNRuTM8=
=tUOf
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
<A href="javascript:" target=_blank gdf-obfuscated-mailto="HP9vvHbH674J">MinGW...@....net

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:<A href="javascript:" target=_blank gdf-obfuscated-mailto="HP9vvHbH674J">mingw-use...@lists.sourceforge.net?subject=unsubscribe


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to start MSYS with arguments for the first command executed

lrn-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08.07.2013 04:32, Marissa McDowell wrote:

> On Friday, March 30, 2012 10:48:37 AM UTC-4, LRN wrote:
>> On 30.03.2012 17:43, nikola bozovic wrote:
>>> I am working on windows XP, and msys.bat is processed from built in
>>> MS-DOS command prompt, aka cmd.exe. command sh also accepts a lot
>>> of arrguments, and one of them is -c whic is suposed to be followed
>>> by command for execution. that works olso, but when i call sh -c
>>> "notepad" it opens notepad, but it does not change terminal. if i
>>> try sh --login -i -c "notepad" situation is the same. I need msys
>>> to load first and then to execute command. if i write these two in
>>> msys bat it does nothin, just open and close terminal window.
>> This is quoted from bash manual:
>>> -c string Read and execute commands from string after processing
>>> the options, then exit. Any remaining arguments are assigned to the
>>> positional parameters, starting with $0.
>> That is, `-c' does exactly what it meant to do.
>>
>> Now, to execute something on msys startup you can place a script with
>> .sh extension into ~/.profile.d/ directory (create it if it doesn't
>> exist). Shell will run every script in that directory every time you
>> run a login shell (i.e. with --login).
>> If you want this to be executed only for one startup, add a `rm' call
>> into that script file:
>> cat ~/.profile.d/run_once.sh
>> #!/bin/sh
>> start notepad.exe
>> rm ~/.profile.d/run_once.sh
>>
> Hi were you able to come up with a solution to this problem? I am
> trying to accomplish a similar task and have not had any luck.
>
The solution i gave to the OP is valid.
What i probably forgot to tell him is that he needs to add this snippet:

mkdir -p ~/.profile.d
for i in ~/.profile.d/*.sh ~/.profile.d/*.bash ; do
  if [ -f $i ]; then
    . $i
  fi
done

to ~/.profile
After that putting things into ~/.profile.d would work.

If you're too lazy to edit ~/.profile, just put the script i've attached
to this message into /etc/profile.d/ and restart MSYS.

Now, obviously, you could have just put things into /etc/profile.d/ in
the first place, but that is not a "good" way of doing this (in real
systems you usually need to be root to change things in /etc/)


- --
O< ascii ribbon - stop html email! - www.asciiribbon.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)

iQEcBAEBAgAGBQJR2k94AAoJEOs4Jb6SI2Cw5xQIAIffukFumnHeV+85AFQT5YDf
rGSAu2E/n3mIEpQt79d9z8pMwYoqLmOLK4CMluoUgJ6MgGdc3/GcNFVINUaevR0u
EtQajV+LRrT5zLsAYe1GqaDAuoGi6Cqbk9Qp3K8OP7nsGTH+k7JctdU08A/A9p5P
0iLvjQm5odEzaklsWk2RKUyXw8i8LTr0zYK1hhkA+3Sxe9V+DGkatqblZp5NCutq
rIbat7HnzSyuzCDNIajjsMJCVKI6AwVO5pgA8Xo1fOchl9KNZVl195hhqzE/9VfU
FP+ZOZnTAvGY8GlL7nKTH7XqiR1p6tVOfWefDKYQSyIublwUUaQEe0SYQFujcJk=
=z/D+
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe

profilirate_home.sh (489 bytes) Download Attachment