delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/09/27/01:39:01

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=M+s4qXd5B9L/pn5C
XkTeY2316sL4JVB+8bHrxK++3VDKDcHww1U71CZ7PFok9MPT6CH8fUIGzZV8kvN7
Gi8OzzuV+ue7LjyF/j4KKXq2VNo6U+Bu/1vseJTKrQVwaDf5p5X0WkqJi43ltCh9
pEAWxWlqIwtY6zgCO5LsfW2sADE=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=PncO3RReHBOBhXtwuLNI2t
FvTMw=; b=TxPKdu+4YccP2Ip8hw3JNAqHnL2jGpRXRNVYehQN9ZP+C+p7S5vAx5
LL4sgez7DRrpba02qmEHDAx6B7UGnV/qtxvE2v7INeXTm0G1S258mS/OE6sMM8um
eDqE1SynVR9oC4YxiMHAOruOCo0SqoF9tSS8imXsKqZKqnSEnO90k=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 spammy=3.0.7-1, montrealer, dynv, Montrealer
X-HELO: smtp-out-no.shaw.ca
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Subject: Re: shell script giving error message "No such file or directory" on cygwin 3.0.7-1
To: cygwin AT cygwin DOT com
References: <CAGYhDoNQZWedTz1zDsdgCmgdu47b8oWqCz5ET2XD2tL316mR+Q AT mail DOT gmail DOT com>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Openpgp: preference=signencrypt
Message-ID: <e86e7ce2-daef-b839-0876-66cd7f249f0d@SystematicSw.ab.ca>
Date: Thu, 26 Sep 2019 23:38:03 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
MIME-Version: 1.0
In-Reply-To: <CAGYhDoNQZWedTz1zDsdgCmgdu47b8oWqCz5ET2XD2tL316mR+Q@mail.gmail.com>
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019