Or transfer the file under a temporary fileaname which ends in ".txt" and rename it afterwards.
I sometimes cut/paste from notepad in to vi (where my connection is through a Windows program emulating a unix terminal).
While I remember, in the filename you post the "?" is probably not a question mark.
Use the "-b" switch to "ls" to find out if there are funny characters in the filename:
FTPing .txt file did not work nor did text mode FTPing. It was retaining the return characters. I am also using an application "Putty". So I also copy pasted into the vi editor and this worked perfect!!!!!
Yes the question mark was not really a question mark but a return character only.
Thanks a lot for replying correctly and that too quickly. The program is working perfect !!!
I have written this program enitrely by going through various posts in this site only.
I am very new to the world of Unix, in the middle of a crash course as I write this due to a system failure for my company. This system went down approximately 24 hours ago due to some apparent thunderstorms that passed through. The problem is that my company, like many others, has laid off... (5 Replies)
$ errpt | more
IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION
3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR
B8113DD1 0802050205 T H fcs1 LINK ERROR
B8113DD1 0802050205 T H fcs1 LINK ERROR
3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR
B8113DD1 ... (0 Replies)
$ errpt | more
IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION
3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR
B8113DD1 0802050205 T H fcs1 LINK ERROR
B8113DD1 0802050205 T H fcs1 LINK ERROR
3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR
B8113DD1 ... (2 Replies)
Hi all, dummy here.... I have major errors on entering the shell. On login I get:
-bash: dircolors: command not found
-bash: tr: command not found
-bash: fgrep: command not found
-bash: grep: command not found
-bash: grep: command not found
-bash: id: command not found
-bash: [: =: unary... (12 Replies)
So in my shell i execute:
{ while true; do echo string; sleep 1; done } | read line This waits one second and returns.
But
{ while true; do /bin/echo string; sleep 1; done } | read line continues to run, and doesn't stop until i kill it explicitly.
I have tried this in bash as well as zsh,... (2 Replies)
Bit of a weird one i suppose, i want to use an echo inside an echo... For example...
i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos...
echo "echo "hello"" >$file
echo "echo "goodbye"" >$file
... (3 Replies)
echo `echo ` doesn't echoes anything. And it's logic. But
echo `echo `echo ` ` does echoes "echo". What's the logic of it? the `echo `echo ` inside of the whole (first) echo, echoes nothing, so the first echo have to echo nothing but echoes "echo"
(too much echoing :P):o (2 Replies)
I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here.
I have following script (called out_to_streams.csh):
#!/bin/tcsh -f
echo Redirected to STDOUT > /dev/stdout
echo Redirected to... (2 Replies)
Hi guys,
Been messing around with shell programming for a couple of days and I found something that was pretty odd in the behavior of the echo command. Below is an example-:
When I type the following in my /home directory from my lxterminal in Debian-:
echo "`ls -l`"
I get the... (2 Replies)
Discussion started by: sreyan32
2 Replies
LEARN ABOUT HPUX
optopt
getopt(3C)getopt(3C)NAME
getopt(), optarg, opterr, optind, optopt - get option letter from argument vector
SYNOPSIS DESCRIPTION
returns the next option letter in argv (starting from that matches a letter in optstring. argc and argv are the argument count and argu-
ment array as passed to optstring is a string of recognized option characters; if a character is followed by a colon, the option takes an
argument which may or may not be separated from it by whitespace.
is the index of the next element of the vector to be processed. It is initialized to 1 by the system, and updates it when it finishes with
each element of
returns the next option character from argv that matches a character in optstring, if there is one that matches. If the option takes an
argument, sets the variable to point to the option argument as follows:
o If the option was the last character in the string pointed to by an element of argv, then contains the next element of argv, and is
incremented by 2. If the resulting value of is greater than or equal to argc, this indicates a missing option argument, and returns
an error indication.
o Otherwise, points to the string following the option character in that element of argv, and is incremented by 1.
If, when is called, is NULL, or the string pointed to by either does not begin with the character or consists only of the character returns
-1 without changing If points to the string returns -1 after incrementing
If encounters an option character that is not contained in optstring, it returns the question-mark character. If it detects a missing
option argument, it returns the colon character if the first character of optstring was a colon, or a question-mark character otherwise.
In either case, sets the variable to the option character that caused the error. If the application has not set the variable to zero and
the first character of optstring is not a colon, also prints a diagnostic message to standard error.
The special option can be used to delimit the end of the options; -1 is returned, and is skipped.
RETURN VALUE
returns the next option character specified on the command line. A colon is returned if detects a missing argument and the first character
of optstring was a colon
A question-mark is returned if encounters an option character not in optstring or detects a missing argument and the first character of
optstring was not a colon
Otherwise, returns -1 when all command line options have been parsed.
EXTERNAL INFLUENCES
Locale
The category determines the interpretation of option letters as single and/or multi-byte characters.
International Code Set Support
Single- and multibyte character code sets are supported.
ERRORS
fails under the following conditions:
[EILSEQ] An invalid multibyte character sequence was encountered during option processing.
EXAMPLES
The following code fragment shows to process arguments for a command that can take the mutually exclusive options and and the options and
both of which require arguments:
#include <stdio.h>
#include <unistd.h>
main (int argc, char *argv[])
{
int c;
int bflg, aflg, errflg;
extern char *optarg;
extern int optind, optopt;
.
.
.
while ((c = getopt(argc, argv, ":abf:o:")) != -1)
switch (c) {
case 'a':
if (bflg)
errflg++;
else
aflg++;
break;
case 'b':
if (aflg)
errflg++;
else {
bflg++;
bproc( );
}
break;
case 'f':
ifile = optarg;
break;
case 'o':
ofile = optarg;
break;
case ':': /* -f or -o without arguments */
fprintf(stderr, "Option -%c requires an argument
",
optopt);
errflg++;
break;
case '?':
fprintf(stderr, "Unrecognized option: - %c
",
optopt);
errflg++;
}
if (errflg) {
fprintf(stderr, "usage: . . . ");
exit(2);
}
for ( ; optind < argc; optind++) {
if (access(argv[optind], 4)) {
.
.
.
}
WARNINGS
Options can be any ASCII characters except colon question mark or null
SEE ALSO getopt(1), thread_safety(5).
STANDARDS CONFORMANCE getopt(3C)