General :: How To Handle Character In Bash Shell

Apr 30, 2011

i have a script where i need to pass an argument "1234:-)"if i run this as ./shell.sh 1234:-)it wont work because invalid character. i need to handle this with expect utility so if i pass it as ./shell.sh "1234:-)"no issue in bash but expect does not recognize this.

View 7 Replies


ADVERTISEMENT

General :: Use The Man / Info / Apropos Pages - Character Instructed The Shell To Interpret A Special Character As An Ordinary Character?

Mar 27, 2010

1.What character instructd the shell to interpret a special character as an ordinary character?

2.What directory contains some of the utilities available on the system in the form of binary files?

3. What command is used to search the location of a utility?

4. What command is used to instruct the editor to write the file and quit the editor?

5. What key quits the more utility and displays the shell prompt?

6. What command starts a child shell as the super user, taking on root's identity and environment?

7. Which wildcard characters can be used for searching all the files in the system that start with "A"?

8. The user name or login name of the super user is????

[Code]....

View 10 Replies View Related

General :: Echo Newline Character Not Working In Bash?

Mar 11, 2011

I have bash script which has lots of echo statements and also I aliased echo to echo -e both in .bash_profile and .bashrc, so that new lines are printed properly for a statement like echo 'Hello World' the output should be I even tried using shopt -s expand_aliases in the script, I am running my script as bash /scripts/scriptnm.sh; if I run it as . /scripts/scriptnm.sh I am getting the desired output.

View 4 Replies View Related

Fedora :: Handle A Gnome-shell Lock Up?

Jun 7, 2011

Sooner or later you may experience a Gnome shell lock up. After two weeks of daily use I experienced my first one today: the cursor turned to a hand, and no amount of clicking and pressing Esc would have any effect; Windows key didn't bring Activities in focus either. If you experience these or similar symptoms you can restart the gnome-shell in order to unlock the Gnome session:

1) pass to a console (press Ctrl+Alt+F2)

2) log in

3) execute: ps -ef | grep gnome-shell in order to find the gnome-shell process id (PID); the output may look something like

[Code]...

Pressing Ctrl+ALt+F1 (or, if that doesn't work -- Ctrl+ALt+F7) should take you back to the Gnome session. You should see the restarted gnome-shell. (You can now return to the console, log out from the console, and return to the Gnome session).

View 2 Replies View Related

General :: "find And Replace" In Shell (includes The / Character)?

Feb 27, 2011

I would like to know what shell command I could use for finding a phrase (which is a URL) in many files, with a different phrase. I have tried the "sed" command, but it does not like the forward slash.

View 5 Replies View Related

General :: Bash Scripting - Sed - Lame - Character To Lame To Escape Spaces

Mar 20, 2010

Ok, so I find myself ripping audio CDs frequently, which I then lame to mp3's to put on my media player. I usually define the --ta and --tl (artist and album) ID3 tags and batch encode each album, but don't bother with the track tags as I'd have to do each one seperately.

So, I'm working on a script to do all this for me, extracting info from 'pwd' etc. to fill in the blanks for --ta, --tl and --tt (track name). All is working well, except that I can't get sed to pass on the "" character to lame to escape spaces.

Here's what I've got so far: (trouble spot is bolded - no need to pay attention to the rest of it)

Code:

All this does is pass a 'space' on to lame, which it takes as an invalid argument.

View 10 Replies View Related

Ubuntu :: ESC Character In Dash Shell

Oct 21, 2010

when I try to enter an escape sequence in the interactive mode of dash, it keeps on spewing out the <ESC> character as ^[ displayed in plain text instead of catching it as a control character. I vaguely remember encountering this on some UNIX shell but for the life of me I can't find anything on it. So how do I properly enter escape sequences in dash's interactive mode? (it supposedly supports vi line edit mode but I can't access it at all because of the ESC situation)It's not a make-or-break thing.

View 2 Replies View Related

Programming :: Bash Script Can't Handle Errors When Run By Cron

Jan 8, 2009

I have a script that that is supposed to send me an e-mail when a host is not responding to ping:

The script works fine when I execute it directly but when cron executes it, the ping error is never picked up by the script so the if statement is ignored.

View 4 Replies View Related

Programming :: Handle Files With Spaces In Their Names In Bash?

Apr 1, 2011

*I'm using Ubuntu 10.10

My issue is I can't handle the files with spaces in their name, I've donde the below script to print each file found inside folder and subbfolders with "find".

I would like to "ls" to each file found with its complete path and with its basename too.

Code:
files=$(find . -type f)
for each in "$files"
do
ls -l "$each" # 1rst option I've tried to list with full path
ls -l "$(/bin/echo "$each")" # 2nd option I've tried to list with full path
ls -l "$(/bin/echo $(basename "$each"))" # 1nd option I've tried to list with it basename

[Code].....

How can I list "ls -l" in both cases (with full path and with basename) when there are files with spaces in their name?

View 6 Replies View Related

Fedora :: Stuck With Bash Shell / Changing Default Shell To Tcsh?

Mar 14, 2010

I want to change my default shell to tcsh. I used

Code:
usermod -s /bin/tcsh username
command as given at url

But if I open a new shell, it is still a bash shell.

How do I make my default shell as tcsh?

View 6 Replies View Related

General :: How To Use Foreach In Bash Shell

Mar 25, 2010

I used c-shell previously in unix. One of the useful command I used frequently is foreach.> foreach a (`cat list`)>> echo $a need to use bash shell now instead, and realized that I can't use foreach anymore. The command is not found. Does anyone knows if there is similar command / function in bash shell?

View 9 Replies View Related

General :: Use Bash Shell When I Run A Program From It?

May 11, 2011

So I open firefox from my bash shell with:

Code:
firefox google.ca
it opens firefox, I can browse, etc.
Now if I alt-tab back into my shell, i can't enter any commands in the shell.

I know that i can do this if I close firefox, but I want to keep working in my shell with firefox still open.

Is this possible?

View 6 Replies View Related

Programming :: Replace Character With Hex Value Choosing From Shell Cmd Line?

Jun 9, 2011

I am bouncing a file across platforms (windows->solaris->mainframe), and the file is starting out with a "special" character (the registered trademark "circle R") in some of the records. This character is not in the EBCDIC character set on the MF, so it is unrecognizable. The MF developer I am working with asked if it is possible to replace the character with a specific hex value (AF) before it gets to the MF.

I was putzing around with sed, tr, etc. on the ksh command line, hoping to find an easy way to get one of them to substitute hex instead of ASCII. I have found that the usual shell utilities recognize the trademark character, so homing in on what to replace is solved. But I cannot get anything to actually substitute in the hex sequence I want. E.g. I was thinking something like...

>cat special_file | sed 's/R/AF/g'

But my version of sed does not seem to have hex "editing" capability.

View 5 Replies View Related

General :: How To Unlimited Bash/shell History

May 4, 2010

Is there a way to define an unlimited history in Bash ?

View 3 Replies View Related

General :: Get Bash History From Another Shell Instance

Aug 18, 2010

Possible Duplicate: Can history files be unified in bash? I have bash running in an ssh session, call this session A. I leave the office, go home, ssh to the same box, call this session B. From session B, I'd like to be able to look at the history of session A.

View 1 Replies View Related

General :: How To Get Bash Shell History Range

Oct 4, 2010

How can I get/filter history entries in a specific range?I have a large history file and frequently usehistory | grep somecommandNow, my memory is pretty bad and I also want to see what else I did around the time I entered the command.For now I do this:get match, say 4992 somecommand, then I do history | grep 49[0-9][0-9]this is usually good enough, but I would much rather do it more precisely, that is see commands from 4972 to 5012, that is 20 commands before and 20 after. I am wondering if there is an easier way? I suspect, a custom script is in order, but perhaps someone else has done something similar before.

View 2 Replies View Related

General :: How To Minimize Bash Shell Prompt

Oct 26, 2010

Currently the terminal prompt looks like this:[karlis@karlis-desktop current_folder]$How can I minimize the prompt, so that it only shows $ or # without extra info in square brackets?I checked the preferences for the default Gnome-Terminal and Terminator - there are no settings for this. It is pretty hard to use terminal when working in directories with long names.

View 1 Replies View Related

General :: Bash Shell Script With Menu?

Apr 12, 2011

I've written a bash shell script (code provided below) that gives the user 4 options. However I'm having a little trouble with the code. Right now when they select option 3, to show the date.It loops over and over again.I have to close the terminal window to stop it because it's an infinite loop. How would I prevent this? Also quit doesn't seem to be working either.

#!/bin/bashe
echo -n "Name please? "
read name
echo "Menu for $name[code]............

View 2 Replies View Related

General :: Bash - Get ' Quote ` Back-tic Through The Shell Into Sed?

Aug 3, 2011

In linux how do I to get the ascii decimal/hex/oct code from a char or a ascii char from a decimal/hex/oct code. I see from the gnu sed user manual that I can use the d# o# x# to specify a character but I am not sure how to use that. If some one has a better way to get the the ` and ' chars through I want to sed with the backtick '`' character and ''' single quote character.

sed '/`/p'

these don't work

sed '/'/p'
sed '/`/p'

View 3 Replies View Related

General :: Bash Shell Scripting Request?

Feb 27, 2011

I am working on a simple script that should take two command line arguments, a [number] and a [name]. The first thing the script should do is check to make sure that no more and no less than two command line arguments have been entered when calling the script - an error message should be delivered if the condition is not true.

If two args have been entered, then the message 'processing "scriptname"' should appear, where scriptname is the name of the script being called. The script should then write to the screen "Hi [name]!", and should write this phrase [number] of times. For example, the command $ myscript 2 joe would produce the output: I have read the manual many times looking for examples, and I am very close by virtue of my own efforts. Further, I have searched these forums and others for good examples, which have also gotten me very close. Still my script is not completing the objective, and I am wondering if someone could point me in the right direction. Script:

[Code]...

View 13 Replies View Related

General :: Using Bash Shell Script Inside Php?

Dec 30, 2010

how do i use bash shell scripts inside php.I am just trying to call a simple cp command using php. Its not doing anything.

View 2 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Ubuntu :: Bash No Longer Supports The Character?

Mar 25, 2011

A very strange problem started for me today. I SSHed into a server and could not type the letter 'i'. It would work fine if I was not in an SSH session, but consistently and repeatedly broke when I started SSH. I rebooted my machine, and the problem now occurs any time I'm using Bash, whether SSHing or not. For the record, I'm doing all this in the standard gnome-terminal.

First: it is not a problem with my keyboard. As you can see, I am perfectly capable of typing the letter 'i' in a browser window. In fact, capital 'I' works fine in bash as well. If I start nano from Bash, I can type the letter 'i' all day long, but when I exit to the Bash prompt, again I am unable to.

What's even more bizarre, I cannot even paste the letter 'i' into bash, either via Ctrl+Shift+v or by middle mouse clicking. This makes it impossible for me to type commands like 'vim' or 'exit'. Bash scripts, however, appear to have no problem with this particular character. Now, I've commented everything out of my .bashrc file, but that didn't help. I got rid of my custom .xmodmaprc file. Still nothing. Keyboard layout is U.S. English. I removed all Keyboard Shortcuts that involve the letter 'i'. Rebooted half a dozen times, still no luck.

My workaround at present is to use zsh instead of bash. Everything works fine with it, but I'd really like to get this thing fixed.

View 4 Replies View Related

Programming :: Csh Shell Script - String Concatenation - Add A New Line Character?

May 4, 2009

Inside a loop i'm populating a string variable. Because csh doesn't have very good support for arrays I thought of doing this. I want to add a new line character to the end of the concatenation each time the loop iterates. Then at the end print this variable out.

I tried " and some resources said it was just a "". Neither work. What am I doing wrong?

View 1 Replies View Related

General :: Invoke A Function In Bash Shell Script?

Apr 24, 2010

I just wonder the distinction calling the function between $(one_function) and one_function in bash shell script.

When I set the variable PS1 in ~/.bashrc, I can't invoke the function by one_func
ex:

export PS1="
[e[31m] $(one_func) # it works
export PS1="
[e[31m] one_func # it doesn't work

View 3 Replies View Related

General :: How To Update A Form Using Shell/bash Script

May 9, 2011

I am wondering is it possible to echo values like below described? The situation is - there are too many "doc" files named like "PLCI507_01234567.doc", and there is a Form in a text file named "form.txt" looks like below:

I am already able to create files in the same format for each documents but now I want all the information in a single form and the form should be updated with file informations ie. file name, created date, md5sum etc.

The updated form.txt should be like below.

View 2 Replies View Related

General :: Users Cannot Connect To The FTP Unless Their Shell Access Is /bin/bash

Oct 4, 2009

I have a CentOS dedicated server running ProFTP. I have created user accounts which are meant for FTP access only but the users cannot connect to the FTP unless their shell access is /bin/bash

Here is an example line that is outputted when I use this command:

This user can access the FTP fine, but he can also access SSH which I don't want to allow him to do. If I set his shell access to /bin/false then he can't connect to the FTP.

What can I use in instead of /bin/bash to allow FTP but don't allow SSH?

View 2 Replies View Related

General :: Changing Shell From C To Bash - Apps Or Variables?

Jun 21, 2010

I have a user that has been used for long time now that runs o C Shell... now there is a need to change it to Bash Shell? Can I cause a problem changing his shell from C to bash? I mean apps or variables?

View 2 Replies View Related

General :: Clear Screen Command For BASH Shell

Jan 21, 2010

I am unable to use clear or cls command on bash shell. I have recently installed Cygwin and am using that for practicing unix commands.

I see that I can use Ctrl + L to clear the screen. I created an alias in my .bashrc to do the same as
alias cls='^L'

This is how i defined other aliases e.g.

And they work. Hence I assume cls will work too but this is what I get when I try to give cls on command prompt. Am i missing something? Is there a way to do this?

Then someone suggested, You cannot alias keystrokes to commands or vice versa. You could just alias cls to an echo command: echo -en "x0c"

And I added the following to .bashrc,

Sourced the .bashrc file. No errors but cls still does not clear the screen. Infact when I typed the echo -en "x0c on command prompt as well, nothing happened. What does this command do?

View 3 Replies View Related

General :: Evaluation Of Postfix String Using Bash Shell

Mar 15, 2011

I would like to evaluate a postfix string using bash shell script,but I do not know how to start.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved