Search Results

Search found 4482 results on 180 pages for 'mr bash'.

Page 5/180 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Anomaly with bash PS1 definition

    - by Michael Wiles
    My root and admin user both have the same .bashrc file. The prompt section of the .bashrc is the following: if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" ;; *) ;; esac But the problem is that the admin user and root user have different prompts. admin's prompt is: admin@hostname:~$ and root's prompt is root@hostname:/home# So it seems root is using the "xterm" version and admin is not. Why does the .bashrc file have this difference in prompts? How do I get the admin user to also use the xterm version? How would I test that condition? If I run echo $TERM while running as the admin user I get xterm so as far as I can tell, it should be using the xterm version for the admin user.

    Read the article

  • bash profile works for user but not sudo

    - by user564448
    I've modified my .profile to include a folder if a flash drive is plugged in. When running the command as the user it works fine but tells me the scrip must be run by sudo (this is what i want). However, when i try to run it with sudo i get "command not found" I have a symlink (flash) in my /var/www folder pointing to my /media/flash drive. (nevermind this setup since is just for dev) this is my user's .profile : # set PATH so it includes flash scripts if [ -d "/var/www/flash/scripts" ] ; then PATH="/var/www/flash/scripts:$PATH" fi when trying to run as sudo i get: sudo: script: command not found any ideas?

    Read the article

  • Bash command history not working

    - by user12663
    The command history between sessions is not getting saved. I'm using guake and the history for the session is working fine. I noticed that .bash_history had some commands I executed in sudo -s mode and tried the same again and all the commands while in the session got saved so I tried chmod 777 .bash_history Now the old commands appear at the start of a session but no new commands are getting saved Thanx in advance

    Read the article

  • How do I change bash history completion to complete what's already on the line?

    - by blokkie
    I found a command a couple of months ago that made my bash history auto-complete on what's already on the line when pressing the up arrow: $ vim fi Press ? $ vim file.py I'd like to set this up on my new computer, because it saves a lot of time when keeping a big history. The problem is that I can't for the life of me remember where it was mentioned and reading through endless bash references and tutorials unfortunately didn't help either. Does anybody know the command?

    Read the article

  • Can't get expand_aliases to take effect

    - by sachmet
    I can't get expand_aliases to take effect in bash. I've tried a lot of different things, and nothing works. Here's the simple test case: /bin/bash -c 'shopt -s expand_aliases; alias cdtmp="cd /tmp"; alias; cdtmp; pwd;' And the output: $ /bin/bash -c 'shopt -s expand_aliases; alias cdtmp="cd /tmp"; alias; cdtmp; pwd;' alias cdtmp='cd /tmp' /bin/bash: cdtmp: command not found /home/user $ /bin/bash --version GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. (Yes, I'm using shopt instead of the -O option to bash, just to prove it's being done.) Any ideas?

    Read the article

  • Differences between fish and bash to pass commandline arguments to alias functions?

    - by NES
    From the answers to my other question here i learned about the possibility to pass commandline arguments to a alias function in Bash. In Fish i can edit an alias by editing the file config.fish in ~/.config/fish directory and adding a line like this alias lsp='ls -ah --color=always | less -R;' and it works perfectly. This should be the equivalent to editing ~/.bash_aliases in bash But when i try to setup an alias function to pass arguments like this alias lsp='_(){ ls -ah --color=always $* | less -R; }; _' it doesn't work for fish? Are there any differences between fish and bash in the way to setup an alias to pass commandline arguments that prevent this second alias from working with fish instead of bash?

    Read the article

  • Bash History not containing all history and blank after reboot, how to resolve?

    - by TryTryAgain
    I've recently upgraded from 13.04 to 13.10 and realized my terminal bash history is not surviving reboots. cat ~/.bash_history gave me a permissions denied error. I, possibly unnecessarily or wrongly, issued a chmod 777 ~/.bash_history to see if that would help...and although I could then cat and read some contents it contained not much of anything as far as history. I also tried sudo rm ~/.bash_history after reading bash history not being preserved Strangely, after doing that, I typed a few test commands, ls, ls -lah ... and upon pressing the up arrow to go back through history it contained those two commands as well as the odd history from some far off time in the past but very few results and not the hundreds of commands I typed earlier in the day. Is there a new place bash history is stored? How can removing ~/.bash_history not get rid of the commands that are somehow lingering? I am not certain, but I believe my root bash history is acting normal. My user bash history is what's causing me trouble. Any help and guidance in tracking down and solving this problem is appreciated.

    Read the article

  • Is there a difference between "." and "source" in bash, after all?

    - by ysap
    I was looking for the difference between the "." and "source" builtin commands and a few sources (e.g., in this discussion, and the bash manpage) suggest that these are just the same. However, following a problem with environment variables, I conducted a test. I created a file testenv.sh that contains: #!/bin/bash echo $MY_VAR In the command prompt, I performed the following: > chmod +x testenv.sh > MY_VAR=12345 > ./testenv.sh > source testenv.sh 12345 > MY_VAR=12345 ./testenv.sh 12345 [note that the 1st form returned an empty string] So, this little experiment suggests that there is a difference after all, where for the "source" command, the child environment inherits all the variables from the parent one, where for the "." it does not. Am I missing something, or is this is an undocumented/deprecated feature of bash? [ GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu) ]

    Read the article

  • Why some user functions don't get recognised by bash?

    - by strapakowsky
    I can define a function like: myfunction () { ls -R "$1" ; } And then myfunction . just works. But if I do echo "myfunction ." | sh echo "myfunction ." | bash the messages are: sh: myfunction: not found bash: line 1: myfunction: command not found Why? And how can I call a function that comes from a string if not by piping it to sh or bash? I know there is this command source, but I am confused of when I should use source and when sh or bash. Also, I cannot pipe through source. To add to confusion, there is this command . that seems to have nothing to do with the "." that means "current directory".

    Read the article

  • Delete until previous punctuation mark in Bash

    - by hekevintran
    In Bash, Ctrl + W will erase the last word. Bash considers words to be delimited by spaces. This means that if the cursor is at the end of the string "cd /dir1/dir2/dir3" and you hit Ctrl + W you will be left with "cd ". Is there a Bash shortcut (custom defined is okay) that will leave me with "cd /dir1/dir2/"?

    Read the article

  • Simple bash scripting

    - by Richard Cotton
    I'm trying to get to grips with bash scripting via cygwin. My script is about as simple as it gets. I change the directory to the root of my C drive, and print the new location. #!/usr/bin/bash cd /cygdrive/c pwd is saved in the file chdir.sh in my home directory. I then call ./chdir.sh from the bash prompt. This results in the error : No such file or directorygdrive/c /cygdrive/c/Documents and Settings/rcotton I definitely have a C drive, and the command cd /cygdrive/c works when I call it directly from the bash prompt. I realise that this problem is likely stupidly simple; please can you tell me what I'm doing wrong.

    Read the article

  • Accessing the output of a Bash pipe with 'read'

    - by Karthik
    I'm trying to pipe some data from a Bash pipe into a Bash variable using the read command, like this: $ echo "Alexander the Grape" | read quot $ echo $quot $ But quot is empty. Some Googling revealed that this is not a bug; it's an intended feature of Bash. (Section E5 in the FAQ.) But when I tried the same thing in zsh, it worked. (Ditto for ksh.) Is there any way to make this work in Bash? I really don't want to have to type: $ quot=$(echo "Alexander the Grape") Especially for long commands.

    Read the article

  • Call 'script' command and exit it from within a bash script

    - by William Jamieson
    I'm using the linux 'script' command http://www.linuxcommand.org/man_pages/script1.html to log all input and output in an interactive bash script. At the moment I have to call the script command, then run my bash script, then exit. I want to run the script and exit commands from within the actual bash script itself. How can I do this? I've tried script -a but that doesn't work for interactive scripts. Any assistance would be greatly appreciated.

    Read the article

  • Bash script 'while read' loop causes 'broken pipe' error when run with GNU Parallel

    - by Joe White
    According to the GNU Parallel mailing list this is not a GNU Parallel-specific problem. They suggested that I post my problem here. The error I'm getting is a "broken pipe" error, but I feel I should first explain the context of my problem and what causes this error. It happens when trying to use any bash script containing a 'while read' loop in GNU Parallel. I have a basic bash script like this: #!/bin/bash # linkcheck.sh while read domain do host "$domain" done Assume that I want to pipe in a large list (250mb say). cat urllist | ./linkcheck.sh Running host command on 250mb worth of URLs is rather slow. To speed things up I want to break up the input into chunks before piping it and then run multiple jobs in parallel. GNU Parallel is capable of doing this. cat urllist | parallel --pipe -j0 parallel ./linkcheck.sh {} {} is substituted by the contents of urllist line-by-line. Assume that my systems default setup is capable of running 500ish jobs per instance of parallel. To get round this limitation we can parallelize Parallel itself: cat urllist | parallel -j10 --pipe parallel -j0 ./linkcheck.sh {} This will run 5000'ish jobs. It will also, sadly, cause the error "broken pipe" (bash FAQ). Yet the script starts to work if I remove the while read loop and take input directly from whatever is fed into {} e.g., #!/bin/bash # linkchecker.sh domain="$1" host "$1" Why will it not work with a while read loop? Is it safe to just turn off the SIGPIPE signal to stop the "broken pipe" message, or will that have side effects such as data corruption? Thanks for reading.

    Read the article

  • How to pass bash script arguments to a subshell

    - by Ralf Holly
    I have a wrapper script that does some work and then passes the original parameters on to another tool: #!/bin/bash # ... other_tool -a -b "$@" This works fine, unless the "other tool" is run in a subshell: #!/bin/bash # ... bash -c "other_tool -a -b $@" If I call my wrapper script like this: wrapper.sh -x "blah blup" then, only the first orginal argument (-x) is handed to "other_tool". In reality, I do not create a subshell, but pass the original arguments to a shell on an Android phone, which shouldn't make any difference: #!/bin/bash # ... adb sh -c "other_tool -a -b $@"

    Read the article

  • How to interrupt stuck bash tab completion?

    - by codeape
    Case: A Windows share mounted using samba over a flaky VPN connection (sometimes very slow, sometimes it drops) When doing tab-completion on filenames, my bash shell can freeze up if the VPN is slow or dropped when I am attempting the tab completion. Example: $ cp myfile.zip /mnt/winbox-c/Progr<tab> key pressed here Is there a bash key I can press to get bash out of its hung state when something like this happens?

    Read the article

  • Strange difference in bash behavior across systems

    - by pinkie_d_pie_0228
    I have two systems, an Ubuntu computer and an Android tablet. I have built and configured bash for Android to be used in adb, so it's the same version as my Ubuntu bash, and they use mostly the same bashrc and configuration, and the same exact options set by shopt. However, there is a slight difference in that the Android bash behaves as I expect when I I try to tab-complete something using a variable in it, but the Ubuntu bash doesn't. #Android ls $HOME/loc<tab> => ls $HOME/local #As expected Basically, the variable is taken into account when completing. But then #Ubuntu ls $HOME/loc<tab> => ls \$HOME/loc #Undesired behavior. The list of options is as follows, and is the same in both builds of bash. autocd:checkwinsize:cmdhist:expand_aliases:extglob:extquote:force_fignore:histappend:interactive_comments:progcomp:promptvars:sourcepath What can be making the Ubuntu version escape the $ instead of using it for completion as in the Android build? What can I do to make both work the same way? Any help will be greatly appreciated.

    Read the article

  • How to make BASH try and autocomplete on Enter

    - by swatso33
    I've noticed that for many of the commands I use in bash I have actually learned how many letters of the command I must type before I can press [TAB] to have bash successfully autocomplete the command. For example when opening chromium I dont usually type the whole command but instead type $ chrom[TAB][ENTER] and bash successfully autocompletes the command to chromium before I hit the [ENTER] key. Is there a way to make autocomplete work without having to hit [TAB]? My general thinking is that if I type $ chrom[ENTER] bash could check and see that chrom isnt a valid command, but it would make sense to autocomplete it to chromium since that is the only command that starts with chrom

    Read the article

  • Sourcing a script file in bash before starting an executable

    - by abigagli
    Hi, I'm trying to write a bash script that "wraps" whatever the user wants to invoke (and its parameters) sourcing a fixed file just before actually invoking it. To clarify: I have a "ConfigureMyEnvironment.bash" script that must be sourced before starting certain executables, so I'd like to have a "LaunchInMyEnvironment.bash" script that you can use as in: LaunchInMyEnvironment <whatever_executable_i_want_to_wrap> arg0 arg1 arg2 I tried the following LaunchInMyEnvironment.bash: #!/usr/bin/bash launchee="$@" if [ -e ConfigureMyEnvironment.bash ]; then source ConfigureMyEnvironment.bash; fi exec "$launchee" where I have to use the "launchee" variable to save the $@ var because after executing source, $@ becomes empty. Anyway, this doesn't work and fails as follows: myhost $ LaunchInMyEnvironment my_executable -h myhost $ /home/me/LaunchInMyEnvironment.bash: line 7: /home/bin/my_executable -h: No such file or directory myhost $ /home/me/LaunchInMyEnvironment.bash: line 7: exec: /home/bin/my_executable -h: cannot execute: No such file or directory That is, it seems like the "-h" parameter is being seen as part of the executable filename and not as a parameter... But it doesn't really make sense to me. I tried also to use $* instead of $@, but with no better outcoume. What I'm doing wrong? Andrea.

    Read the article

  • bash tips needed for understanding how to escape characters in command-line

    - by Jesper Rønn-Jensen
    My knowledge of commandline bash is missing on a particular area: I constantly forget how to properly escape characters. Today I wanted to echo this string into a file: #!/bin/env bash python -m SimpleHTTPServer echo "#!/bin/env bash\npython -m SimpleHTTPServer" server.sh && chmod +x server.sh -bash: !/bin/env: event not found That's right: Remember to escape ! or bash will think it's a special bash event command. But I can't get the escaping right! \! yields \! in the echoed string, and so does \\!. Furthermore, \n will not translate to a line break. Do you have some general tips that makes it easier for me to understand escaping rules? To be very precise, I'll accept an answer which tells me which characters I should escape on the bash command line? Including how to correctly output newline and exclamation mark in my example.

    Read the article

  • Bash script "read" not pausing for user input when executed from SSH shell

    - by Aaron Hancock
    I'm new to Bash scripting, so please be gentle. I'm connected to a Ubuntu server via SSH (PuTTY) and when I run this command, I expect the bash script that downloads and executes to allow user input and then echo that input. It seems to just write out the echo label for the input request and terminate. wget -O - https://raw.github.com/aaronhancock/pub/master/bash/readtest.sh | bash Any clue what I might be doing wrong? UPDATE: This bash command does exactly what I wanted bash <(wget -q -O - https://raw.github.com/aaronhancock/pub/master/bash/readtest.sh)

    Read the article

  • Why does my $LD_LIBRARY_PATH get unset when using screen with bash?

    - by UltraNurd
    This is related to http://superuser.com/questions/27376/why-does-my-ld-library-path-get-unset-launching-terminal, but a different set of symptoms. First, /usr/bin/screen is setuid as per the other question. Second, the default shell on this system is /bin/tcsh for various historical reasons, and we're not allowed to chsh to /bin/bash, so I typically run bash manually immediately after login. Third, I almost always use screen, but I want ctrl-a ctrl-c in screen to create a new bash "tab", so I always invoke bash first. That is: {~} $ echo $SHELL /bin/tcsh {~} $ bash [~] echo $SHELL /bin/bash [~] screen -U [~] ...and when reconnecting: {~} $ echo $SHELL /bin/tcsh {~} $ screen -dUr [~] echo $SHELL /bin/bash [~] However, my $LD_LIBRARY_PATH is there in tcsh, there in bash, but empty once I run screen; it is still present if I just run screen from tcsh, but then I get new tcsh "tabs" when I use ctrl-a ctrl-c in screen. Any ideas?

    Read the article

  • pattern matching in Bash

    - by Tim
    Hi, Here is an example to get different parts of a filename bash-3.2$ pathandfile=/tmp/ff.txt bash-3.2$ filename=$(basename $pathandfile) bash-3.2$ echo $filename ff.txt bash-3.2$ echo ${filename##*.} txt bash-3.2$ echo ${filename%.*} ff I was wondering what does ## and % mean in the patterns. How is the patten matching working? Thanks and regards!

    Read the article

  • Bash wonkyness on Ubuntu versus RHEL

    - by d34dh0r53
    Fellow faulters, I'm playing around with a one liner that I've developed on a RHEL 5.4 box and I have it working perfectly: TOTAL_RAM=`free | grep Mem: | awk '{ print $2 }'`; \ ps axo rss,comm,pid | awk -v total_ram=$TOTAL_RAM \ '{ proc_list[$2] += $1; } END { for (proc in proc_list) \ { proc_pct = (proc_list[proc]/total_ram)*100; printf("%d\t%s\t%0.2f%\n", proc_list[proc],proc,proc_pct); }}' \ | sort -n | tail -n 10 Which outputs something like the following on my RHEL box: 3736 logmon 0.01% 4156 EvMgrC 0.01% 4692 hald 0.01% 5020 ntpd 0.02% 6252 sshd 0.02% 7784 cvd 0.02% 9224 snmpd 0.03% 13068 dsm_sa_datamgr3 0.04% 23320 dsm_om_connsvc3 0.07% 4249864 mysqld 12.90% However on my Ubuntu 9.04 slice I get this: awk: run time error: not enough arguments passed to printf("%d %s %0.2f% ") FILENAME="-" FNR=104 NR=104 33248 console-kit-dae 3.17 I think it has to be bash that is borking something, but I'm really not doing anything that should be that bash specific. The RHEL box is running: # yum info bash | grep -e Version -e Release Version : 3.2 Release : 24.el5 And the Ubuntu box: # apt-cache show bash | grep -e Version Version: 3.2-5ubuntu1 I haven't dug into this super deeply, and thought I'd ping my fellow johnnys to see if you've ever run across this before. /bow

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >