Search Results

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

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

  • Creating A Simple Bash Script With Multiple Commands

    - by unorthodox grammar
    Trying to create a bash script that opens gnome-terminal, and then runs ls to display the contents of a directory, but it just opens gnome-terminal. I will be creating some other scripts that also use multiple commands. My script: #!/bin/bash gnome-terminal ls -a /examplefolder EDIT: To clarify what I'm trying to achieve. I'm trying to create a script that will open gnome-terminal, list the contents of /examplefolder, and then be ready for regular terminal usage. Is this possible, or am I barking up the wrong tree?

    Read the article

  • Dynamic case statement in bash

    - by infra.user
    Hi folks, I'm trying to figure out how to create a dynamic case statement in a bash script. For example, let's say I have the output of an awk statement with the following contents red green blue In this scenario, the output can change at any time. I'm trying to then execute different logic if a value is included in this awk output. So if the data above is in $list, then I'd conceptually like to do something like: case "${my_var}" in $list) ..... something_else) ..... esac I'm trying to use this to build a dynamic custom tab completion function (see http://www.debian-administration.org/article/An_introduction_to_bash_completion_part_2 for some background). Any ideas? Thanks.

    Read the article

  • fixed width bash prompt

    - by seaofclouds
    I'd like to set my bash prompt to a fixed width, and make up the difference in space before the $, so whether long or short, my prompt remains the same width: [name@host] ~/Directory/Dir...Another/LastDir $ [name@host] ~/Directory(branch) $ Currently, in a short directory path my prompt looks something like this: [name@host] ~/Directory(branch) $ a deeper directory path looks like this: [name@host] ~/Directory/Dir...Another/LastDir $ You can see I've truncated the PWD in the middle so I can see where the path begins, and where it ends. I'd like to make up the difference before the $. Here is my current prompt: # keep working directory to 30 chars, center tuncated prompt_pwd() { local pwd_symbol="..." local pwd_length=30 newPWD="${PWD/#$HOME/~}" [ ${#newPWD} -gt ${pwd_length} ] && newPWD=${newPWD:0:12}${pwd_symbol}${newPWD:${#newPWD}-15} } # set prompt prompt_color() { PROMPT_COMMAND='prompt_pwd;history -a;title_git' PS1="${WHITEONMAGENTA}[\u@\h]${MAGENTA} \w\$(parse_git_branch) ${MAGENTABOLD}\$${PS_CLEAR} " PS1=${PS1//\\w/\$\{newPWD\}} PS2="${WHITEONTEAL}>${PS_CLEAR} " } In my search, I found A Prompt the Width of Your Term which does do some fill, but couldn't get it working for this particular prompt.

    Read the article

  • What steps put my bash prompt commands into vim and then back again to bash to execute?

    - by xtian
    I've enabled VIM style editing of bash commands at the bash prompt as default bash setting. On a few occasions I've accidentally opened a blank vim file with some complex bash command I was writing. Awesome. How do I get the newly written line in vim back into bash? I found another post where the author had the opposite trouble--or so it seems. What steps put my bash prompt commands into vim and then back again to bash to execute?

    Read the article

  • Remove a line from a csv file bash, sed, bash

    - by S1syphus
    I'm looking for a way to remove lines within multiple csv files, in bash using sed, awk or anything appropriate where the file ends in 0. So there are multiple csv files, their format is: EXAMPLEfoo,60,6 EXAMPLEbar,30,10 EXAMPLElong,60,0 EXAMPLEcon,120,6 EXAMPLEdev,60,0 EXAMPLErandom,30,6 So the file will be amended to: EXAMPLEfoo,60,6 EXAMPLEbar,30,10 EXAMPLEcon,120,6 EXAMPLErandom,30,6 A problem which I can see arising is distinguishing between double digits that end in zero and 0 itself. So any ideas?

    Read the article

  • Bash script not adding variables to session

    - by travega
    I have a bash script that I have added as a startup application. It does a bunch of exports and alias assignment. #! /bin/bash alias devhm='cd ${DEV_HOME}; ll'; alias wlhm='cd ${WL_HOME}; ll'; alias dirch='watch --interval=1 "ls -la"'; alias vols='watch --interval=1 "df -h"'; alias svn-update='svn update --depth infinity ./*'; alias mci="~/mci.sh"; alias vncserver="vncserver -geometry 1680x1050"; alias ..="cd .."; alias hist="history | grep "; export PROXY_HOST=proxy.my.setup; export PROXY_PORT=3128; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH/usr/lib/oracle/12.1/client64/lib; export ORACLE_HOME=/usr/lib/oracle/12.1/client64; export TNS_ADMIN=${ORACLE_HOME}/network/admin; echo "DONE!"; But none of these values are available in my terminal sessions anymore. Even when I run the script straight into the terminal like so: ./setup.sh I see the "DONE!" prompt printed but no aliases or env variables are set. If I copy and paste the contents of the file into the terminal the aliases and env variables are set. I have tried adding a line to execute the script from .bashrc also but still no aliases or env variables set. Any ideas what might be going on here? Also could anyone suggest a better way to have these env variables/aliases added to every terminal session?

    Read the article

  • Howto switch / chage user id witin a bash script to execute commands in the same script?

    - by a1an
    Is there a way to switch user identity within a script (executed as root as part of an installation process) to execute some commands without calling an external sctipt, then be back to root to run other commands? Sort of: #!/bin/bash some commands as root SWITCH_USER_TO user some commands as user including environment variables checks, without calling an external script SWITCH_USER_BACK some other stuff as root, maybe another user id change...

    Read the article

  • Bash Printing, how to

    - by Uncle Leo
    Wrote a script in bash. Now im need to bring information into a text file,for example in PostScript, but there is one problem. I need to have a certain length of string in characters, and stretch or shrink the string on the entire width of the page layout. I have tried a2ps and enscript, but there is no such option. Please tell me the solution to this problem, maybe in Ghostscript. Thanks in advance!

    Read the article

  • How to have multiple path separators in Bash

    - by binW
    I have few python scripts which were written by someone else in Windows. These scripts use double backslash as path separator but when run in Ubuntu they don't work because of this. I can change all \ to / and scripts will work but there are lot of scripts and its a lot of effort to change each \ to / So my question is: Is it possible to add \ as path separator in Ubuntu or only in Bash so that I dont have to modify these scripts?

    Read the article

  • Why do digits in bash script names screw up path lookups?

    - by cannikin
    I've got a simple script that lists a bunch of EC2 servers and automates me connecting to them. This script lives at ~/bin/ec2 My PATH looks something like: /Users/rob/bin:/Users/rob:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin Whenever I call ec2 I get: -bash: /Users/rob/ec2: No such file or directory Unless I give it the full path, then it'll work. If I rename the script to just ec then I can run it from anywhere like expected. Have digits in script names always been a problem like this? I'm on Mac OSX.

    Read the article

  • Bash alias to open Vim at last edit mark

    - by Pierre LaFayette
    The mark " in Vim takes you to your last edit position. I want to create an alias that will open my Vim instance and jump to that mark; something which is obviously extremely useful. This works from the command line: $ vim -c "'\"" File.cpp Now I want to make an alias for this: $ alias v='vim -c "'\"" File.cpp' Well that's not going to work! You need to escape the first single quote you say... $ alias v='vim -c "\'\"" File.cpp' Hmm. That didn't work either... So I try a whole lot of variations of single quoted and double quoted madness, bang my head against the table and load up stackoverflow in my browser, and here we are. How do I properly escape this alias?

    Read the article

  • Bash alias to open Vim at last cursor position mark

    - by Pierre LaFayette
    The mark " in Vim takes you to your last cursor position. I want to create an alias that will open my Vim instance and jump to that mark; something which is obviously extremely useful. This works from the command line: $ vim -c "'\"" File.cpp Now I want to make an alias for this: $ alias v='vim -c "'\""' Well that's not going to work! You need to escape the first single quote you say... $ alias v='vim -c "\'\""' Hmm. That didn't work either... So I try a whole lot of variations of single quoted and double quoted madness, bang my head against the table and load up stackoverflow in my browser, and here we are. How do I properly escape this alias?

    Read the article

  • Bash completion doesn't work, or is ignoring what I've typed; but works for commands

    - by Neil Traft
    Bash completion seems to be ignoring what I've typed (it tries to complete, but acts as if there's nothing under the cursor). I know I saw it work on this machine earlier today, but I'm not sure what has changed. Some examples: cd shows all directories under my current folder: $ cd co<tab><tab> cmake/ config/ doc/ examples/ include/ programs/ sandbox/ src/ .svn/ tests/ Commands like ls and less show all files and directories under my current folder: $ ls co<tab><tab> cmake/ config/ .cproject Doxyfile.in include/ programs/ README.txt src/ tests/ CMakeLists.txt COPYING.txt doc/ examples/ mainpage.dox .project sandbox/ .svn/ Even when I try to complete things from a different folder, it gives me only the results for my current folder (telling me that it is completely ignoring what I've typed): $ cd ~/D<tab><tab> cmake/ config/ doc/ examples/ include/ programs/ sandbox/ src/ .svn/ tests/ But it seems to be working fine for commands and variables: $ if<tab><tab> if ifconfig ifdown ifnames ifquery ifup $ echo $P<tab><tab> $PATH $PIPESTATUS $PPID $PS1 $PS2 $PS4 $PWD $PYTHONPATH I do have this bit in my .bashrc, and I have confirmed that my .bashrc is indeed getting sourced: if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi I've even tried manually executing that file, but it doesn't fix the problem: $ . /etc/bash_completion There was even one point in time where it was working for ls, but was not working for cd ... but I can't replicate that result now. Update: I also just discovered that I have terminals open from earlier that still work. I ran source .bashrc in one of them and afterwards completion was broken. Here is my .bashrc: # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples # # Modified by Neil Traft #source ~/.profile # Allow globs to expand hidden files shopt -s dotglob nullglob # If not running interactively, don't do anything [ -z "$PS1" ] && return # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # If set, the pattern "**" used in a pathname expansion context will # match all files and zero or more directories and subdirectories. #shopt -s globstar # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # set variable identifying the chroot you work in (used in the prompt below) if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # Color the prompt export PS1="\[$(tput setaf 2)\]\u@\h:\[$(tput setaf 5)\]\W\[$(tput setaf 2)\] $\[$(tput sgr0)\] " # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' #alias dir='dir --color=auto' #alias vdir='vdir --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi

    Read the article

  • Trouble editing ~/.bash_profile: -bash: $'\r': command not found

    - by Dave
    I installed CygWin on Windows 7. Using Notepad, I edited my ~/.bash_profile file to add on to the PATH variable … PATH="${PATH}:/cygdrive/c/apache-ant-1.8.2/bin" Now, when I SSH in to my Windows machine, I get this error … -bash: $'\r': command not found -bash: $'\r': command not found -bash: $'\r': command not found -bash: $'\r': command not found -bash: $'\r': command not found -bash: /home/dev/.bash_profile: line 39: syntax error: unexpected end of file and my PATH is not set. Anyone know how I can correct this?

    Read the article

  • Configure Console2 to open bash in current folder

    - by davidkennedy85
    I've seen this but it doesn't work for me. I'm not using Git's version of bash but the one that comes with cygwin, so that could be part of the problem. Here is how I have my tab in Console2 set up: Title: bash.exe Shell: C:\cygwin\bin\bash.exe --login -i Startup dir: %HOMEDRIVE%%HOMEPATH% This is my registry entry: Directory shell Console2 Open Console2 Here command "C:\Console2\Console.exe" -d "%1" bash always starts in my home directory instead of the directory I'm clicking on, then I have to cd /cygdrive/d/code ... etc. I tried removing the value in the "Startup dir" field, changing it to %1, %1% with no luck. I also tried this solution but it didn't work for me either: Title: bash.exe Shell: C:\cygwin\bin\bash.exe -l Registry: Directory shell Console2 Open Console2 Here command "C:\Console2\Console.exe" -d "%V" .profile file in root directory: cd - Any ideas?

    Read the article

  • How to make bash quit tab autocompleting hidden directories

    - by Kristopher Micinski
    Most of the time, I don't need autocompletes for my hidden directories. In fact, that's the point of them being hidden! However, annoyingly, bash takes these directories into account when considering tab autocompletion. This is particularly annoying when I have the following scenario: a .svn foler along with a single folder that I want to traverse into by simply pushing tab. (This typically comes up with deep Java packages...) Is there any way to change the default behavior? Worst case scenario I have to type '.' before tab, which seems like a no brainer for my usability.

    Read the article

  • Making a bash script that reconnect to AP when connection lost

    - by Alexander
    I'm facing problems with WIFI on ubuntu i tried to update the system but still the same what happens is that i suddenly lose the connection with my router and when i press on the WIFI bar the system won't detect any APs i have to uncheck "enable WIFI" option ,then re check it so it work,it automatically reconnect. I'm thinking of making a bash script that detects when the pc is disconnected from the router for any reason, and when it is disconnected it disable then enable the wifi. i mean like automating resetting the connection that possible ? i guess i must use this nmcli nm wifi off nmcli nm wifi on but how can i make the script know if the PC is disconnected from the WIFI ?

    Read the article

  • How to escape this in the bash script?

    - by allenskd
    I'm trying to complete a batch of 3 videos to leave it there till morning processing but it seems there are special characters in it... I try it "raw" in the terminal and it works but in bash script it stops working Example: args1="-r 29.97 -t 00:13:30 -vsync 0 -vpre libx264-medium -i" args12="-r 29.97 -ss 00:40:30 -vsync 0 -vpre libx264-medium -i" args2="[in] scale=580:380 [T1],[T1] pad=720:530:0:50 (other arguments with lots of [ and ]" In the output it says Unable to find a suitable output format for 'scale=580:380' not sure why... like I said, the command runs fine in the command-line, just not in the script /usr/local/bin/ffmpeg "$args1" "${file}" -vf "$args2" "$args3" "${args[0]}_${startingfrom}_0001_02.mp4"

    Read the article

  • A problem with Bash script

    - by c.sokun
    I want to write a simple script to detect a file created by Windows virus, usually it create an .exe file with the same name as the directory it drop. Here is the script it only work if the path name doesn't contain \n. Can someone help me fix this script please! #!/bin/bash if [ $# == 0 ]; then echo "" echo "==== Give me a directory to begin with! ====" echo "" exit fi for f in `find $1 -name '*.exe'` | do filename=`basename "$f" .exe` dir_name=`dirname "$f"` current_dir_name=`basename "$dir_name"` if [ $filename == $current_dir_name ]; then rm -f "$f" # It can't remove file where path contain space or \n ??!! fi done

    Read the article

  • Problem with Bash script: 'declare: not found'

    - by Ashfame
    I had a script which was running fine but when I ran it today, it says declare: not found. I am using bash shell and path at the starting of the script is correct. Two flagged lines in my script are as follows: declare -a RESPONSE RESPONSE=($RESULT) It also says ( is unexpected but I guess that is coming up because of the first error. Worth mentioning point is when I type in declare directly works fine. declare | grep USER shows USER=ashfame USERNAME=ashfame values="$SVN_BASH_USERNAME"; So, whats wrong here?

    Read the article

  • Bash does not remember programs with non 0 exit status in history

    - by Amigable Clark Kant
    I enter a command. It fails. I press arrow up, modify something and enter it again ... hold it right there. It used to work like that. Now it's more like: I enter a command. It fails. I press arrow up, get the last command which didn't fail, likely "ls" or something useless and I type the whole thing again back by hand. What happened? It wasn't always like this. But it's quite some time since this behavior changed, I'll give you that. Some years ago, at least. How do I put some sanity back into my bash prompt?

    Read the article

  • Sendmail not working as desired in bash script

    - by dan08
    This is the code I have in a bash script that runs as a cronjob. The cronjob run as root. /usr/sbin/sendmail [email protected]<<EOF subject:Backup Error! from:backup@server01 $error EOF There is code after this and the email I get is as follows: From the root user on the machine. and the message includes: subject:Backup Error! from:backup@server01 $error EOF More code... that is in the script all the way to the end... I have tried other variations, this is the closest I've got. I tried this in a regular script and it worked properly. Whats going on, and how can I send this email, specifying the subject and form sender?

    Read the article

  • bash-completion for xelatex

    - by andreas-h
    I'm on Ubuntu 12.04. When using bash as my shell, I can just type latex my_do <TAB> to compile a file my_document.tex, as *bash_completion* does the auto-complete. However, this auto-completion does not work for the xelatex executable. So I would like to add the same auto-complete functionality for xelatex as exists for latex. I could find that the latex auto-complete feature comes from the file /etc/bash_completion, where I could find a line complete -f -X '!*.@(?(la)tex|texi|dtx|ins|ltx)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi Now I could of course just add xelatex to that line and everything is fine. However, I'm wondering if I could instead put a file in /etc/bash_completion.d, as this would leave the system file untouched. Unfortunately, I'm at a complete loss about the syntax -- but maybe someone can help me here?

    Read the article

  • bash script to login to webpage

    - by Nathan Cazell
    I am trying to login into this page but I cannot for the life of me get it to work. I have to login to this site when i connect to my school's wifi in order to start a session. So far ive tried to use bash and cUrl to achieve this but have only achieved to give myself a headache. will cUrl work or am I on the wrong track? Any help is greatly appreciated! Thanks, N Here's what i tried: curl --cookie-jar cjar --output /dev/null http://campus.fsu.edu/webapps/login/ curl --cookie cjar --cookie-jar cjar \ --data 'username=foo' \ --data 'password=bar' \ --data 'service=http://campus.fsu.edu/webapps/login/' \ --data 'loginurl=http://campus.fsu.edu/webapps/login/bb_bb60/logincas.jsp' \ --location \ --output ~/loginresult.html \ http://campus.fsu.edu/webapps/login/

    Read the article

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