LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-24-2011, 01:25 AM   #1
Ubx
LQ Newbie
 
Registered: Feb 2011
Posts: 2

Rep: Reputation: 0
bash -D (or bash --dump-strings) unexpected result


Instead of a dump of $ strings, I'm getting a prompt that doesn't process commands and seemingly can't be exited. Is this correct? I don't have access to a BSD or other Unix environment to allow a comparison with a non-GNU environment, but the current result certainly doesn't match the man page.

I've tried this with the following environments:
  • Ubuntu 9.10 (GNU bash, version 4.0.33(1)-release (i486-pc-linux-gnu))
  • Centos 5.5 (GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu))
 
Old 02-24-2011, 06:27 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Can't say I know exactly what that command switch is for, but...

I ran it on a virtual machine (e.g. "bash -D"), and yes, you get another Bash environment--in other words a shell within a shell, but without any environment variables. For instance, my subshell had a prompt of "bash-4.1$" which (I believe) is the default prompt if $PS1 is not set.

Also, you can exit the sub-shell by pressing Ctrl-D.

Again, I'm not sure what the -D is supposed to accomplish. I just glanced at the man page, but as I recall, the description did say "no commands will be executed."

I'll play with it a little more and see if I can figure out exactly what it's intended use is.

EDIT:
Well, playing with it some and reading the man page literally:
Code:
DH@virtUbuntu:~$ bash -D
bash-4.1$ "hello"
bash-4.1$ "PS1"
bash-4.1$ $"PS1"
"PS1"
bash-4.1$ $PS1
bash-4.1$ "$PS1"
bash-4.1$ $"$PS1"
"$PS1"
bash-4.1$ <Ctrl-D>
DH@virtUbuntu:~$
So, as the man page says:
Quote:
A list of all double-quoted strings preceded by $ is printed on the standard output
I imagine you would redirect standard input from a file, the output of a command, or something else to make this more useful.

EDIT2:

As an example:
Code:
DH@virtUbuntu:~$ echo '$"greetings" "earthling" "we" $"are" "your" $"new" $"overlords"' > test_data.txt
DH@virtUbuntu:~$ bash -D < test_data.txt
"greetings"
"are"
"new"
"overlords"
DH@virtUbuntu:~$

Last edited by Dark_Helmet; 02-24-2011 at 06:42 PM.
 
Old 02-24-2011, 07:41 PM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,378
Blog Entries: 3

Rep: Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478
Hi,

Welcome to LQ!
Quote:
Originally Posted by Ubx View Post
Instead of a dump of $ strings, I'm getting a prompt that doesn't process commands and seemingly can't be exited. Is this correct? I don't have access to a BSD or other Unix environment to allow a comparison with a non-GNU environment, but the current result certainly doesn't match the man page.

I've tried this with the following environments:
  • Ubuntu 9.10 (GNU bash, version 4.0.33(1)-release (i486-pc-linux-gnu))
  • Centos 5.5 (GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu))
I would start at 4,5 &6 below since your query requirements are aligned to these. Look at Rute for some useful examples. While the other links will enhance your Gnu/Linux experience;



1 Linux Documentation Project
2 Rute Tutorial & Exposition
3 Linux Command Guide
4 Bash Beginners Guide
5 Bash Reference Manual
6 Advanced Bash-Scripting Guide
7 Linux Newbie Admin Guide
8 LinuxSelfHelp
9 Utimate Linux Newbie Guide

The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning Strings - Bash isdigit Linux - Newbie 6 12-25-2009 12:52 AM
bash result to PHP eco Programming 3 05-18-2009 07:50 PM
Need help with bash and strings Histamine Programming 4 06-27-2007 05:18 PM
bash and strings graziano1968 Linux - Software 2 10-01-2004 07:50 AM
BASH Command Result redhatnoob Programming 2 08-19-2004 07:25 PM


All times are GMT -5. The time now is 03:57 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration