public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* shell script giving error message "No such file or directory" on cygwin 3.0.7-1
@ 2019-09-27  2:50 DynV Montrealer
  2019-09-27 11:18 ` Brian Inglis
  2019-09-27 11:42 ` Eliot Moss
  0 siblings, 2 replies; 5+ messages in thread
From: DynV Montrealer @ 2019-09-27  2:50 UTC (permalink / raw)
  To: Cygwin Project mailing list

I've tried updating Cygwin a few days ago, hopefully I did it right and it
seems its version cygwin 3.0.7-1, with its kernel version 3.0.7(0.338/5/3).
If you did not realize it, I'm unfamiliar with Cygwin, as well as with
GNU/Linux.
I managed to do a command that give the result I wanted (I've tested it
successfully) ; its censored version is "sed -e 'WORKING_REGEX' -i
/cygdrive/REGEX_FILE_FULL_PATH". I then copy-pasted it (from Cygwin64
Terminal) into a file I saved with the extension .sh hoping to have that
work as a shell script. I then input in the terminal the uncensored
"./cygdrive/SHELL_SCRIPT_FULL_PATH" and got the uncensored version of
"-bash: ./cygdrive/SHELL_SCRIPT_FULL_PATH: No such file or directory". Oh!
And it likely is the right path as when I do the command "ls
/cygdrive/SHELL_SCRIPT_FULL_PATH" it gives the output
"/cygdrive/SHELL_SCRIPT_FULL_PATH".

Is there a way to make a Cygwin shell script with the command? Or do I have
to make a text file giving instructions (copy-paste, etc.) ?

Thank you kindly,
DynV

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: shell script giving error message "No such file or directory" on cygwin 3.0.7-1
  2019-09-27  2:50 shell script giving error message "No such file or directory" on cygwin 3.0.7-1 DynV Montrealer
@ 2019-09-27 11:18 ` Brian Inglis
  2019-09-27 11:42 ` Eliot Moss
  1 sibling, 0 replies; 5+ messages in thread
From: Brian Inglis @ 2019-09-27 11:18 UTC (permalink / raw)
  To: cygwin

On 2019-09-26 20:43, DynV Montrealer wrote:
> I've tried updating Cygwin a few days ago, hopefully I did it right and it
> seems its version cygwin 3.0.7-1, with its kernel version 3.0.7(0.338/5/3).
> If you did not realize it, I'm unfamiliar with Cygwin, as well as with
> GNU/Linux.
> I managed to do a command that give the result I wanted (I've tested it
> successfully) ; its censored version is "sed -e 'WORKING_REGEX' -i
> /cygdrive/REGEX_FILE_FULL_PATH". I then copy-pasted it (from Cygwin64
> Terminal) into a file I saved with the extension .sh hoping to have that
> work as a shell script. I then input in the terminal the uncensored
> "./cygdrive/SHELL_SCRIPT_FULL_PATH" and got the uncensored version of
> "-bash: ./cygdrive/SHELL_SCRIPT_FULL_PATH: No such file or directory". Oh!
> And it likely is the right path as when I do the command "ls
> /cygdrive/SHELL_SCRIPT_FULL_PATH" it gives the output
> "/cygdrive/SHELL_SCRIPT_FULL_PATH".

More likely your PATH or whatever script or file is being used is not set up
such that it is doing what you think.

> Is there a way to make a Cygwin shell script with the command? Or do I have
> to make a text file giving instructions (copy-paste, etc.) ?
Shell scripts must be in Unix text format (only \n newlines - no \r CRs) and
executable.
Please run "file script" and "ls -glo script" and post the output, including the
actual file names, please; for example, to show some differences:

	$ file genfl.sh ja.cmd
	genfl.sh: Bourne-Again shell script, ASCII text executable
	ja.cmd:   ASCII text, with CRLF line terminators
	$ ls -glo genfl.sh ja.cmd
	-rwxr-xr-x+ 1 236 Nov 28  2017 genfl.sh
	-rwxr-xr-x+ 1 722 Nov 27  2017 ja.cmd

You can convert a DOS text file to Unix text by running d2u/dos2unix on it:
	$ d2u script
and you can make it executable using change mode (permissions):
	$ chmod +x script

Executable scripts may be run by the invoking shell, or by the default shell
/bin/sh, depending on the invoking shell.

To specify a script interpreter, make the first line of each script a shebang
line, starting #!, optionally followed by blanks, followed by an interpreter
path or program name e.g. "#!/bin/sh", "#! /bin/bash", "#! /bin/dash", etc.

Strictly speaking the command should not exceed 14 characters, although that is
not enforced by shells nowadays, but some old commercial system shells may.

You must either specify a relative or absolute path to an executable:
	$ ./script
or have it in a directory in your PATH where it can be found by searching.

If you create a bin subdirectory under your home directory to hold scripts:
	$ mkdir ~/bin/
some shell profiles will add it to your PATH, or you can do so explicitly:
	$ export PATH="$HOME/bin:$PATH"

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: shell script giving error message "No such file or directory" on cygwin 3.0.7-1
  2019-09-27 11:42 ` Eliot Moss
@ 2019-09-27 11:42   ` Brian S. Wilson
  2019-09-27 13:37   ` Brian S. Wilson
  1 sibling, 0 replies; 5+ messages in thread
From: Brian S. Wilson @ 2019-09-27 11:42 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1.1: Type: text/plain, Size: 1662 bytes --]


On 09/27/2019 07:18, Eliot Moss wrote:
> On 9/26/2019 10:43 PM, DynV Montrealer wrote:
>> I've tried updating Cygwin a few days ago, hopefully I did it right
>> and it
>> seems its version cygwin 3.0.7-1, with its kernel version
>> 3.0.7(0.338/5/3).
>> If you did not realize it, I'm unfamiliar with Cygwin, as well as with
>> GNU/Linux.
>> I managed to do a command that give the result I wanted (I've tested it
>> successfully) ; its censored version is "sed -e 'WORKING_REGEX' -i
>> /cygdrive/REGEX_FILE_FULL_PATH". I then copy-pasted it (from Cygwin64
>> Terminal) into a file I saved with the extension .sh hoping to have that
>> work as a shell script. I then input in the terminal the uncensored
>> "./cygdrive/SHELL_SCRIPT_FULL_PATH" and got the uncensored version of
>> "-bash: ./cygdrive/SHELL_SCRIPT_FULL_PATH: No such file or
>> directory". Oh!
>> And it likely is the right path as when I do the command "ls
>> /cygdrive/SHELL_SCRIPT_FULL_PATH" it gives the output
>> "/cygdrive/SHELL_SCRIPT_FULL_PATH".
>>
>> Is there a way to make a Cygwin shell script with the command? Or do
>> I have
>> to make a text file giving instructions (copy-paste, etc.) ?
>
> I am confused by your ./cygdrive/SHELL_SCRIPT_FULL_PATH.  I would think
> you should omit the leading dot.  cygdrive hangs off the root of the
> cygwin
> file system.  Or maybe you meant . <space> filename?  That would source
> a file.
Rather than continue to recommend the old ". <space> filename" syntax
for sourcing a file, I'd recommend using the "source filename" option. 
It works the same way and is less likely to be confused.

Brian Wilson


[-- Attachment #1.1.2: 0x0E6E241A34F9D685.asc --]
[-- Type: application/pgp-keys, Size: 3167 bytes --]

[-- Attachment #1.1.3: 0x0E6E241A34F9D685.asc --]
[-- Type: application/pgp-keys, Size: 3165 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: shell script giving error message "No such file or directory" on cygwin 3.0.7-1
  2019-09-27  2:50 shell script giving error message "No such file or directory" on cygwin 3.0.7-1 DynV Montrealer
  2019-09-27 11:18 ` Brian Inglis
@ 2019-09-27 11:42 ` Eliot Moss
  2019-09-27 11:42   ` Brian S. Wilson
  2019-09-27 13:37   ` Brian S. Wilson
  1 sibling, 2 replies; 5+ messages in thread
From: Eliot Moss @ 2019-09-27 11:42 UTC (permalink / raw)
  To: cygwin

On 9/26/2019 10:43 PM, DynV Montrealer wrote:
> I've tried updating Cygwin a few days ago, hopefully I did it right and it
> seems its version cygwin 3.0.7-1, with its kernel version 3.0.7(0.338/5/3).
> If you did not realize it, I'm unfamiliar with Cygwin, as well as with
> GNU/Linux.
> I managed to do a command that give the result I wanted (I've tested it
> successfully) ; its censored version is "sed -e 'WORKING_REGEX' -i
> /cygdrive/REGEX_FILE_FULL_PATH". I then copy-pasted it (from Cygwin64
> Terminal) into a file I saved with the extension .sh hoping to have that
> work as a shell script. I then input in the terminal the uncensored
> "./cygdrive/SHELL_SCRIPT_FULL_PATH" and got the uncensored version of
> "-bash: ./cygdrive/SHELL_SCRIPT_FULL_PATH: No such file or directory". Oh!
> And it likely is the right path as when I do the command "ls
> /cygdrive/SHELL_SCRIPT_FULL_PATH" it gives the output
> "/cygdrive/SHELL_SCRIPT_FULL_PATH".
> 
> Is there a way to make a Cygwin shell script with the command? Or do I have
> to make a text file giving instructions (copy-paste, etc.) ?

I am confused by your ./cygdrive/SHELL_SCRIPT_FULL_PATH.  I would think
you should omit the leading dot.  cygdrive hangs off the root of the cygwin
file system.  Or maybe you meant . <space> filename?  That would source
a file.

Regards - Eliot Moss

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: shell script giving error message "No such file or directory" on cygwin 3.0.7-1
  2019-09-27 11:42 ` Eliot Moss
  2019-09-27 11:42   ` Brian S. Wilson
@ 2019-09-27 13:37   ` Brian S. Wilson
  1 sibling, 0 replies; 5+ messages in thread
From: Brian S. Wilson @ 2019-09-27 13:37 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1.1: Type: text/plain, Size: 1662 bytes --]


On 09/27/2019 07:18, Eliot Moss wrote:
> On 9/26/2019 10:43 PM, DynV Montrealer wrote:
>> I've tried updating Cygwin a few days ago, hopefully I did it right
>> and it
>> seems its version cygwin 3.0.7-1, with its kernel version
>> 3.0.7(0.338/5/3).
>> If you did not realize it, I'm unfamiliar with Cygwin, as well as with
>> GNU/Linux.
>> I managed to do a command that give the result I wanted (I've tested it
>> successfully) ; its censored version is "sed -e 'WORKING_REGEX' -i
>> /cygdrive/REGEX_FILE_FULL_PATH". I then copy-pasted it (from Cygwin64
>> Terminal) into a file I saved with the extension .sh hoping to have that
>> work as a shell script. I then input in the terminal the uncensored
>> "./cygdrive/SHELL_SCRIPT_FULL_PATH" and got the uncensored version of
>> "-bash: ./cygdrive/SHELL_SCRIPT_FULL_PATH: No such file or
>> directory". Oh!
>> And it likely is the right path as when I do the command "ls
>> /cygdrive/SHELL_SCRIPT_FULL_PATH" it gives the output
>> "/cygdrive/SHELL_SCRIPT_FULL_PATH".
>>
>> Is there a way to make a Cygwin shell script with the command? Or do
>> I have
>> to make a text file giving instructions (copy-paste, etc.) ?
>
> I am confused by your ./cygdrive/SHELL_SCRIPT_FULL_PATH.  I would think
> you should omit the leading dot.  cygdrive hangs off the root of the
> cygwin
> file system.  Or maybe you meant . <space> filename?  That would source
> a file.
Rather than continue to recommend the old ". <space> filename" syntax
for sourcing a file, I'd recommend using the "source filename" option. 
It works the same way and is less likely to be confused.

Brian Wilson


[-- Attachment #1.1.2: 0x0E6E241A34F9D685.asc --]
[-- Type: application/pgp-keys, Size: 3165 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-27 11:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27  2:50 shell script giving error message "No such file or directory" on cygwin 3.0.7-1 DynV Montrealer
2019-09-27 11:18 ` Brian Inglis
2019-09-27 11:42 ` Eliot Moss
2019-09-27 11:42   ` Brian S. Wilson
2019-09-27 13:37   ` Brian S. Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).