Sponsored Content
Top Forums Shell Programming and Scripting Echo displays strange output when '?' is used Post 303046005 by bedtime on Tuesday 21st of April 2020 01:23:13 PM
Old 04-21-2020
Echo displays strange output when '?' is used

In bash or sh terminal I get this strange response when using echo.


It's really best just to give you the code:

Code:
user@localhost:~$ text="?"; echo $text
P T V
user@localhost:~$ text='?'; echo $text
P T V
user@localhost:~$ text='?'; printf "$text\n"
?

So, printf works nicely but is there a way to get printf to take the escape sequences of variables?


I think it might have happened after messing around with Gnome-Shell extensions but not sure.


Any idea why it's happening or how to get rid of it?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Strange output from grep

Hi, I am getting different output for grep depending which directory I am in. The following is a transcript of my session, I am using egrep but have also used grep -E. The directory names have been changed for security: $pwd /dir1/dir2/dir3/dir4 $echo 000000 |egrep -v $echo $? 1 $cd ..... (10 Replies)
Discussion started by: Bab00shka
10 Replies

2. AIX

who -r displays no output

Hello. I have an AIX machine at 6100-00. We had some strange activity since filling up /tmp. One symptom is that who -r displays no output. It doesn't hang just no output is displayed. We are going to boot the machine, but prior to that I'd like to dig a bit to see what may be causing the... (0 Replies)
Discussion started by: maficdan
0 Replies

3. UNIX for Dummies Questions & Answers

Creating a file that contains output from a command, and then displays itself

hey, I'm trying to create the command that will create a file named user.txt that contains the output of the command cut -d: -f1,5 /etc/passwd, and displays itself afterwards. I don't know how to bridge cat > user.txt with cut -d: -f1,5 /etc/passwd, or how display it afterwards. Any help would... (2 Replies)
Discussion started by: raidkridley
2 Replies

4. Shell Programming and Scripting

strange output

I had a similar script in solaris and it had no problem. I wrote this one in freeBSD and it gave me strange output. Can anyone please tell me why? thanks a lot #!/bin/sh #This is a shell script that checks file system capacity mounted on /home directory #If file system is over 90% capacity,... (1 Reply)
Discussion started by: k2k
1 Replies

5. Solaris

solaris 10 strange df output

hi, in solaris 10 SUN SPARC V245 server the following df -h output is showing . can i reuse the following disk space by deleting them /platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1 20G 5.2G 14G 27% /platform/sun4u-us3/lib/libc_psr.so.1... (2 Replies)
Discussion started by: phani.madiraju
2 Replies

6. Solaris

ls -l displays output with an error

when i use ls command it works normal but when i using additional parameter with ls like ls -l , ls -a... it shows a error followed by the output. # ls -l ./hgfs: Operation not applicable total 12861 -rw-r--r-- 1 root root 0 Jun 1 21:12 1 drwxr-xr-x 2 root root ... (4 Replies)
Discussion started by: chidori
4 Replies

7. UNIX for Advanced & Expert Users

strange output with du

Can someone please explain why I get two outputs with the du command? The first one gave me one. I also didn't ask for the second directory so why did it give that directory? $ du -h "/media/Part 1/Desktop/playlist" 775M /media/Part 1/Desktop/playlist $ du -h "/media/Part... (1 Reply)
Discussion started by: cokedude
1 Replies

8. UNIX for Advanced & Expert Users

Strange /etc/passwd output

Can someone please explain this to me? auser:x:500:500:Anne User:/home/auser:/bin/sh buser:x:501:501:Bob User:/home/buser:/bin/bash I'm used to it looking like this. What is the difference between the first name and second name? In the first case I had to use the first name to change my... (3 Replies)
Discussion started by: cokedude
3 Replies

9. Shell Programming and Scripting

Echo's strange output

Hi, Kindly help me to understand the behavior or logic of the below shell command $ echo $!# echo $echo $ $ $ echo !$# echo $# 0 I am using GNU bash, version 3.2.25(1)-release (2 Replies)
Discussion started by: royalibrahim
2 Replies

10. Shell Programming and Scripting

Script Output Displays Multiple Text

Hello there, I'm using a read-while loop to preserve the word Failed within a text file. For example, if the word Failed exist twice in a single text file, my STDOUT should re-direct to a new text file and display Failed twice. My output is attached to this thread. I would like output to... (4 Replies)
Discussion started by: SysAdminRialto
4 Replies
gettext(1)							   User Commands							gettext(1)

NAME
gettext - retrieve text string from message database SYNOPSIS
gettext [-d textdomain | --domain=textdomain] [textdomain] msgid gettext -s [-e] [-n] [-d textdomain | --domain=textdomain] msgid... DESCRIPTION
The gettext utility retrieves a translated text string corresponding to string msgid from a message object generated with msgfmt(1). The message object name is derived from the optional argument textdomain if present, otherwise from the TEXTDOMAIN environment. If no domain is specified, or if a corresponding string cannot be found, gettext prints msgid. Ordinarily, gettext looks for its message object in /usr/lib/locale/lang/LC_MESSAGES where lang is the locale name. If present, the TEXTDO- MAINDIR environment variable replaces the pathname component up to lang. This command interprets C escape sequences such as for tab. Use \ to print a backslash. To produce a message on a line of its own, either enter at the end of msgid, or use this command in conjunction with printf(1). When used with the -s option, gettext behaves like echo(1). But it does not simply copy its arguments to standard output. Instead, those messages found in the selected catalog are translated. OPTIONS
The following options are supported: -d textdomain Retrieves translated messages from the domain textdomain, if textdomain is not specified as an operand. --domain=textdomain -e Enables expansion of some escape sequences if used with the -s option. -n Suppresses trailing newline if used with the -s option. -s Behaves like echo(1) (see DESCRIPTION above). If the -s option is specified, no expansion of C escape sequences is performed and a newline character is appended to the output, by default. OPERANDS
The following operands are supported: textdomain A domain name used to retrieve the messages. This overrides the specification by the -d or --domain options, if present. msgid A key to retrieve the localized message. ENVIRONMENT VARIABLES
LANG Specifies locale name. LC_MESSAGES Specifies messaging locale, and if present overrides LANG for messages. TEXTDOMAIN Specifies the text domain name, which is identical to the message object filename without .mo suffix. TEXTDOMAINDIR Specifies the pathname to the message database. If present, replaces /usr/lib/locale. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
echo(1), msgfmt(1), printf(1), gettext(3C), setlocale(3C), attributes(5) NOTES
This is the shell equivalent of the library routine gettext(3C). SunOS 5.10 17 Sep 2001 gettext(1)
All times are GMT -4. The time now is 06:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy