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
MinGW...@lists.sourceforge.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:mingw-use...@lists.sourceforge.net?subject=unsubscribe
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
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
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
------------------------------------------------------------------------------
Or perhaps use /etc/profile.d which is processed by /etc/profile during --login.
--
Earnie
-- https://sites.google.com/site/earnieboyd
------------------------------------------------------------------------------
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-----