Search Results

Search found 24505 results on 981 pages for 'bash script'.

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

  • lower-case 'c' key not working in bash

    - by gavin
    This is a bit of a strange one. I'm running Ubuntu 12.04. It's been working well but today, I ran into a hell of strange phenomenon. I can no longer type a lower-case 'c' in bash. At first I thought it was a misconfiguration for the gnome terminal but I tried both a stock xterm and directly at the console (ctrl+alt+F1) and the issue was the same. I can type an upper-case C without any difficulty and I can type lower-case 'c' in any other terminal based program (vim, bash, less, etc.). The lower 'c' also works if I jump into plain old sh. I looked at all the configuration files I know of and haven't found anything incriminating in there. I suspect it's not going to be that simple anyway because if I run bash with the '--norc' option from within sh, the problem remains. I don't know what else to check. In fact, if I wanted to cause this problem on a given machine, I have no idea how it could be done. Total mystery.

    Read the article

  • Shell script with ImageMagick: hangs forever?

    - by AP257
    I've generated a shell script that uses ImageMagick to convert and crop around 18000 images. Here's a sample entry (so there are 18000 of these): if [ ! -f ./cropped/16333-1.png ] then convert -crop 724x118+876+1989 ./lin/34.png ./cropped/16333-1.png echo cropping 16333-1 fi if [ ! -f ./cropped/16333-1_thumb.png ] then convert -define jpeg:size=400x100 ./cropped/16333-1.png -thumbnail '400x100>' -background transparent -gravity center -extent 400x100 ./cropped/16333-1_thumb.png echo thumbing 16333-1 fi The script only runs for about 2000 images before hanging forever. Am I missing something, or leaking memory somewhere? Thanks for your help!

    Read the article

  • Why is this by passing the SUDO password?

    - by John Isaacks
    I have a bash script I am using to automate a SVN checkout. The contents of the file were: #!/bin/bash cd /var/www-cake sudo svn checkout file:///usr/local/svn/bash_repo/repo/ Then when I double click the file it would ask me what to do, I would click the button "Run In Terminal" and then a terminal would pop up and ask me for the SUDO password. I would enter it, the script would execute and the terminal would close. I wanted to give some sort of indication that the script ran successfully so I edited my file to look like: #!/bin/bash cd /var/www-cake sudo svn checkout file:///usr/local/svn/bash_repo/repo/ echo "Head revision has been pushed to live server" I expected the terminal to now stay open and tell me the message afterwards. To my surprise it now opens and immediately closes. The script does execute and I no longer have to put in the SUDO password. Is this right? I do not understand why this is happening, seems like a security issue.

    Read the article

  • Shell Script, iterating over a folder

    - by Martin
    I have very basic shell scripting knowledge. I have photos under original folder on many different folder like this folder + folder1 + original + folder2 + original + folder3 + original + folder4 + original Using mogrify I'm trying to create thumbs under a thumb folder following a structure to this. folder + folder1 + original + thumb + folder2 + original + thumb + folder3 + original + thumb + folder4 + original + thumb I'm a little lost in how to write the shell script that may iterate through it. I'm ok giving mogrify its settings but I don't complete understand how to tell the script to go iterate each folder to run the mogrify command.

    Read the article

  • username and password for rsync in script

    - by sims
    I'm creating a cron job to keep two dirs in sync. I'm using rsync. I'm running an rsync daemon. I read the manual and it says: RSYNC_PASSWORD Setting RSYNC_PASSWORD to the required password allows you to run authenticated rsync connections to an rsync daemon without user intervention. Note that this does not supply a password to a shell transport such as ssh. USER or LOGNAME The USER or LOGNAME environment variables are used to determine the default username sent to an rsync daemon. If neither is set, the username defaults to 'nobody' I have something like: #!/bin/bash USER=name RSYNC_PASSWORD=pass DEST="server::module" /usr/bin/rsync -rltvvv . $DEST I also tried exporting (dangerous, I know) USER and RSYNC_PASSWORD. I also tried with LOGNAME. Nothing works. Am I doing this correctly?

    Read the article

  • Script Bash and History Unix

    - by user1107078
    i just start to use Script bash on UNIX and i didnt find a solution to write the first command in the history which start , for example , with ls. If i write in the shell history !ls it works but when i'm going to create a script it wont work. This is my example code #!/bin/bash set -o | grep history set -o history #echo "HISTFILE is $HISTFILE" #history "!ls"; #history #!ls history #it works Another Question why echo "HISTFILE is $HISTFILE" print me only HISTFILE is ?? Thanks

    Read the article

  • Ubuntu Bash Script changing file names chronologicaly

    - by Manifold
    I have this bash script where I am trying to change all *.txt files in a directory to their date of last modification. This is the script: #!/bin/bash # Renames the .txt files to the date modified # FROM: foo.txt Created on: 2012-04-18 18:51:44 # TO: 20120418_185144.txt for i in *.txt do mod_date=$(stat --format %y "$i"|awk '{print $1"_"$2}'|cut -f1 -d'.'|sed 's/[: -]//g') mv "$i" "$mod_date".txt done The error I am getting is: renamer.sh: 6: renamer.sh: Syntax error: word unexpected (expecting "do") Any help would be greatly appreciated. Thank you for your time.

    Read the article

  • Sed problem in a Bash script

    - by moata_u
    Hello there. I'm having a problem using the sed command . I'm trying to write a bash script that does the following : search for the line that contain :@ then save the line that contained :@ and replace it with new line as in the following: #! /bin/bash echo "Please enter the ip address of you file"<br> read ipnumber<br> find=`grep ':@' application.properties` # find the line<br> input="connection.url=jdbc\racle\:thin\:@$ipnumber\:1521\:billz" # preparing new line<br> echo `sed "s/'${find}'/'${input}'/g" application.properties` # replace old with new line <br> The problem is: nothing happens. I've already tried to use "${find}" instead of '${find}'

    Read the article

  • How do I create a permanent Bash alias?

    - by Bakhtiyor
    I would like to create an alias to rm command in order to have a confirmation message after executing this command. So I am creating an alias like this alias rm='rm -i'. But as far as I know this is a temporary alias and it lives until you close the terminal. As it is explained here to save alias permanently I need to execute ~/.bash_aliases or ~/.bashrc commands in terminal and add my alias there. But when I execute ~/.bashrc I get following error message : bash: /home/bakhtiyor/.bashrc: Permission denied When I run ~/.bash_aliases I get another error message like this: bash: /home/bakhtiyor/.bash_aliases: File or directory doesn't exist. What is the actual problem and how can I solve it?

    Read the article

  • How do I log into bash shell only?

    - by Tom D
    On my home desktop I want to use Ubuntu Unity sometimes and just the bash shell (without any gui) other times. Is it possible to set up a login option where I can choose between using the Unity GUI or just the shell? For example, on the Ubuntu login screen I can choose among Unity, Gnome Shell, XFCE, etc. An option there for just the Bash shell command line would be ideal. I'm not trying to invite "why would you do that" debate here. I have my reasons. Thanks.

    Read the article

  • Bash script using eyeD3 to remove extra tags from mp3 files

    - by jaguare22
    I found what looks like the perfect script for this but getting errors. Hoping someone can see problem. I am running 12.04 Server. Error is - awk: line 0: regular expression compile failed (missing '(') ): awk: line 0: regular expression compile failed (missing '(') ) The following tags have been found in the mp3s: These tags are to be stripped: Here is a the script obtained from savvyadmin !/bin/bash Script name: strip-tags.sh Original Author: Ian of DarkStarShout Blog Site: http://darkstarshout.blogspot.com/ Options slightly modified to liking of SavvyAdmin.com oktags="TALB APIC TCON TPE1 TPE2 TPE3 TIT2 TRCK TYER TCOM TPOS" indexfile=mktemp Determine tags present: find . -iname "*.mp3" -exec eyeD3 --no-color -v {} \; $indexfile tagspresent=sort -u $indexfile | awk -F\): '/^<.*$/ {print $1}' \ | uniq | awk -F\)\> '{print $1}' | awk -F\( '{print $(NF)}' \ | awk 'BEGIN {ORS=" "} {print $0}' rm $indexfile Determine tags to strip: tostrip=echo -n $tagspresent $oktags $oktags \ | awk 'BEGIN {RS=" "; ORS="\n"} {print $0}' | sort | uniq -u \ | awk 'BEGIN {ORS=" "} {print $0}' Confirm action: echo echo The following tags have been found in the mp3s: echo $tagspresent echo These tags are to be stripped: echo $tostrip echo echo -n Press enter to confirm, or Ctrl+C to cancel... read dummy Strip 'em stripstring=echo $tostrip \ | awk 'BEGIN {FS="\n"; RS=" "} {print "--set-text-frame=" $1 ": "}' First pass copies any v1.x tags to v2.3 and strips unwanted tag data. Second pass removes v1.x tags, since I don't like to use them. Without --no-tagging-time-frame, a new unwanted tag is added. :-) find . -iname "*.mp3" \ -exec eyeD3 --to-v2.3 --no-tagging-time-frame $stripstring {} \; \ -exec eyeD3 --remove-v1 --no-tagging-time-frame {} \; echo "Script complete!"

    Read the article

  • Retrieve a command from another, remote bash session

    - by Oli
    So I was on our laptop, SSH'd into my desktop, dropping some mad bashfu skill. There was one command I ran which was particularly skilful. I'm now about minute walk from the laptop and I really want that command here on my desktop, so that I can run it again. I realise I've already spent more time that it would have taken to rewrite it, but this has raised a common issue I have with bash history. I know I can force it to update each command, but I haven't... so: Is there any way to get a history from a different, live bash session?

    Read the article

  • Bash Script help required

    - by Sunil J
    I am trying to get this bash script that i found on a forum to work. Copied it to text editor. Saved it as script.sh chmod 700 and tried to run it. rootdir="/usr/share/malware" day=`date +%Y%m%d` url=`echo "wget -qO - http://lists.clean-mx.com/pipermail/viruswatch/$day/thread.html |\ awk '/\[Virus/'|tail -n 1|sed 's:\": :g' |\ awk '{print \"http://lists.clean-mx.com/pipermail/viruswatch/$day/\"$3}'"|sh` filename=`wget -qO - http://lists.clean-mx.com/pipermail/viruswatch/$day/thread.html |\ awk '/\[Virus/'|tail -n 1|sed 's:": :g' |awk '{print $3}'` links -dump $url$filename | awk '/Up/'|grep "TR\|exe" | awk '{print $2,$8,$10,$11,$12"\n"}' > $rootdir/>$filename dirname=`wget -qO - http://lists.clean-mx.com/pipermail/viruswatch/$day/thread.html |\ awk '/\[Virus/'|tail -n 1|sed 's:": :g' |awk '{print $3}'|sed 's:.html::g'` rm -rf $rootdir/$dirname mkdir $rootdir/$dirname cd $rootdir grep "exe$" $filename |awk '{print "wget \""$5"\""}' | sh ls *.exe | xargs md5 >> checksums mv *.exe $dirname rm -r $rootdir/*exe* mv checksums $rootdir/$dirname mv $filename $rootdir/$dirname I get the following message.. script.sh: line 11: /usr/share/malware/: Is a directory script.sh: line 11: links: command not found

    Read the article

  • build command by concatenating string in bash

    - by Lennart Rolland
    I have a bash script that builds a command-line in a string based on some parameters before executing it in one go. The parts that are concatenated to the command string are supposed to be separated by pipes to facilitate a "streaming" of data through each component. A very simplified example: #!/bin/bash part1=gzip -c part2=some_other_command cmd="cat infile" if [ ! "$part1" = "" ] then cmd+=" | $part1" fi if [ ! "$part2" = "" ] then cmd+=" | $part2" fi cmd+="> outfile" #show command. It looks ok echo $cmd #run the command. fails with pipes $cmd For some reason the pipes don't seem to work. When I run this script i get different error messages relating usually to the first part of the command (before the first pipe). So my question is whether or not it is possible to build a command in this way, and what is the best way to do it?

    Read the article

  • C code - ls system command not showing bash colors

    - by m0atz
    I've just been fooling around with some code in C, an example of a really basic program is as follows which just, obviously, lists the directories using the ls system command. #include <stdio.h> int main (void) { system("ls -l -d */"); printf("I've just listed the directories :-)\n"); return 0; } This runs fine, but it shows the ls output in monochrome, whereas Bash would output the list using colors for the directories (or files if I included files). How can I make my C code use the bash colors? Thanks

    Read the article

  • 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

  • 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

  • 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 Script Exits su or ssh Session Rather than Script

    - by Russ
    I am using CentOS 5.4. I created a bash script that does some checking before running any commands. If the check fails, it will simply exit 0. The problem I am having is that on our server, the script will exit the su or ssh session when the exit 0 is called. #!/bin/bash # check if directory has contents and exit if none if [ -z "`ls /ebs_raid/import/*.txt 2>/dev/null`" ]; then echo "ok" exit 0 fi here is the output: [root@ip-10-251-86-31 ebs_raid]# . test.sh ok [russ@ip-10-251-86-31 ebs_raid]$ as you can see, I was removed from my sudo session, if I wasn't in the sudo session, it would have logged me out of my ssh session. I am not sure what I am doing wrong here or where to start.

    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

  • Setting the Timezone with an automated script

    - by Tom
    I'm writing scripts to automate setting up new slicehost installations. In a perfect world, after I started the script, it would just run, with no attention from me. I have succeeded, with one exception. How do I set the timezone, in a permanent (survive reboot) and sane (adjust for standard and daylight savings time, so no just forcing the date) ... manner that doesn't require input from me? Currently, I'm using dpkg-reconfigure tzdata This doesn't seem to have any way to force parameters into it. It demands user input. EDIT: I'm editing here, rather than commenting, since comments don't seem to allow code blocks. Here's the actual code I ended up with, based on Rudedog's comment below. I also noticed that this doesn't update /etc/timezone. I'm not certain who uses that, but in case anybody does, I'm setting that too. TIMEZONE="America/Los_Angeles" echo $TIMEZONE > /etc/timezone cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime # This sets the time

    Read the article

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