Search Results

Search found 6392 results on 256 pages for 'bash history'.

Page 16/256 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Can I do filename pattern matching in a bash script?

    - by Bob Bowden
    Can I do filename pattern matching in a bash script? "test" is a directory with the following files ... bob@bob-laptop:~/test$ ls exclude exclude1 exclude2 include1 include2 from the command line, if I want to exclude some of the files, I can do ... bob@bob-laptop:~/test$ echo !(exclude*) include1 include2 but, if I put that command in a script (named exclude) ... bob@bob-laptop:~/test$ cat exclude echo !(exclude*) when I execute it, I get an error ... bob@bob-laptop:~/test$ ./exclude ./exclude: line 1: syntax error near unexpected token (' ./exclude: line 1:echo !(exclude*)' I've tried every (I think) variation of escaping some, all or none of the special characters and I still get an error. What am I missing here? If I can't do this, would someone please be so kind as to explain why?

    Read the article

  • Why does a bash-zenity script has that title on Unity Panel and that icon on Unity Launcher?

    - by Sadi
    I have this small bash script which helps use Infinality font rendering options via a more user-friendly Zenity window. But whenever I launch it I have this "Color Picker" title on Unity Panel together with the icon assigned for "Color Picker" utility. I wonder why and how this is happening and how I can change it? #!/bin/bash # A simple script to provide a basic, zenity-based GUI to change Infinality Style. # v.1.2 # infinality_current=`cat /etc/profile.d/infinality-settings.sh | grep "USE_STYLE=" | awk -F'"' '{print $2}'` sudo_password="$( gksudo --print-pass --message 'Provide permission to make system changes: Enter your password to start or press Cancel to quit.' -- : 2>/dev/null )" # Check for null entry or cancellation. if [[ ${?} != 0 || -z ${sudo_password} ]] then # Add a zenity message here if you want. exit 4 fi # Check that the password is valid. if ! sudo -kSp '' [ 1 ] <<<"${sudo_password}" 2>/dev/null then # Add a zenity message here if you want. exit 4 fi # menu(){ im="zenity --width=500 --height=490 --list --radiolist --title=\"Change Infinality Style\" --text=\"Current <i>Infinality Style</i> is\: <b>$infinality_current</b>\n? To <i>change</i> it, select any other option below and press <b>OK</b>\n? To <i>quit without changing</i>, press <b>Cancel</b>\" " im=$im" --column=\" \" --column \"Options\" --column \"Description\" " im=$im"FALSE \"DEFAULT\" \"Use default settings - a compromise that should please most people\" " im=$im"FALSE \"OSX\" \"Simulate OSX rendering\" " im=$im"FALSE \"IPAD\" \"Simulate iPad rendering\" " im=$im"FALSE \"UBUNTU\" \"Simulate Ubuntu rendering\" " im=$im"FALSE \"LINUX\" \"Generic Linux style - no snapping or certain other tweaks\" " im=$im"FALSE \"WINDOWS\" \"Simulate Windows rendering\" " im=$im"FALSE \"WIN7\" \"Simulate Windows 7 rendering with normal glyphs\" " im=$im"FALSE \"WINLIGHT\" \"Simulate Windows 7 rendering with lighter glyphs\" " im=$im"FALSE \"VANILLA\" \"Just subpixel hinting\" " im=$im"FALSE \"CLASSIC\" \"Infinality rendering circa 2010 - No snapping.\" " im=$im"FALSE \"NUDGE\" \"Infinality - Classic with lightly stem snapping and tweaks\" " im=$im"FALSE \"PUSH\" \"Infinality - Classic with medium stem snapping and tweaks\" " im=$im"FALSE \"SHOVE\" \"Infinality - Full stem snapping and tweaks without sharpening\" " im=$im"FALSE \"SHARPENED\" \"Infinality - Full stem snapping, tweaks, and Windows-style sharpening\" " im=$im"FALSE \"INFINALITY\" \"Infinality - Standard\" " im=$im"FALSE \"DISABLED\" \"Act without extra infinality enhancements - just subpixel hinting\" " } # option(){ choice=`echo $im | sh -` # if echo $choice | grep "DEFAULT" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"DEFAULT\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "OSX" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"OSX\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "IPAD" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"IPAD\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "UBUNTU" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"UBUNTU\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "LINUX" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"LINUX\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "WINDOWS" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"WINDOWS\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "WIN7" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"WINDOWS7\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "WINLIGHT" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"WINDOWS7LIGHT\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "VANILLA" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"VANILLA\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "CLASSIC" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"CLASSIC\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "NUDGE" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"NUDGE\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "PUSH" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"PUSH\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "SHOVE" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"SHOVE\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "SHARPENED" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"SHARPENED\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "INFINALITY" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"INFINALITY\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # if echo $choice | grep "DISABLED" > /dev/null; then sudo -Sp '' sed -i "s/USE_STYLE=\"${infinality_current}\"/USE_STYLE=\"DISABLED\"/g" '/etc/profile.d/infinality-settings.sh' <<<"${sudo_password}" fi # } # menu option # if test ${#choice} -gt 0; then echo "Operation completed" fi # exit 0

    Read the article

  • I need to know the reasons why learning Linux Shell Scripting (BASH) benefits me as a PHP developer

    - by Ahmad Farouk
    I have been developing web sites/applications using the LAMP stack for almost 5 years. Currently I am interested to dig more into Linux OS, specifically BASH but from a web developer perspective, not from sys admin perspective. I am not intending to administrate Linux Servers. Only, I want to know, does learning shell scripting benefit me as a PHP developer? Does it make me a better, more skilled developer, or just its something irrelevant? Reasons, and examples are highly appreciated. Thanks in advance.

    Read the article

  • Ubuntu 12.04 Can't Login-Tty Console said: -bash: /usr/bin/byobu/-launch: no such file or directory

    - by zuhudfm
    I face problem in login to Ubuntu 12.04. I think it's caused by accessing super user (if not wrong). I type sudo nautilus to put a background to burg, but i fail x_x. After reboot, i can't login to desktop. But i can login as guest. I had 'googling' for problem solving. Most of it is login to screen like terminal (maybe tty console) by pressing ctrl+alt+F1. But after i login system says: -bash: /usr/bin/byobu/-launch: no such file or directory help help help :(

    Read the article

  • How do global cancel/exit commands work in bash?

    - by SecurityGate
    As I have done multiple times before, I've written bash scripts, and just general commands that go nowhere. They just blink the little command line cursor at me for infinity until I control+C the command. When I do cancel the command, what exactly is going on when I do this? Am I somehow stopping and killing the current PID I'm working on? Does it jump to a different run-level and execute something to terminate the command? On a slightly different note, I've never been able to figure out how to set up something like this in a script or program I've worked on. Since I mostly program in Ruby, can I setup something like a certain key press stops the program? Every time I've looked into doing something similar, I always end up getting hung up when it comes to user input, whether that is a loop waiting for a condition, or something like this: def Break() user_break = gets.strip end def Main() Function1() Break() Function2() Break() [...] end It seems and is incredibly bulky, and definitely isn't easily scaled up or down.

    Read the article

  • how to get bash to stop escaping $ during tab-completion?

    - by keturn
    I have this on the command line: ln -sf $PWD/wine- and then I hit tab to complete the filename. In earlier versions of Ubuntu, this worked just fine to complete the wine- filename (and as a side-effect $PWD would be expanded at that time). But now it turns it in to ln -sf \$PWD/wine- which isn't what I meant at all and doesn't complete anything as the file does not literally start with $. How do I get completion back to the less broken behaviour? set tells me these are my current settings: BASHOPTS=checkwinsize:cmdhist:expand_aliases:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor

    Read the article

  • curl object moved here error, bash

    - by adam n
    I'm trying to download an html file with curl in bash. When I download it manually, it works fine. However, when i try and run my script through crontab, the output html file is very small and just says "Object moved to here." with a broken link. Does this have something to do with the sparse environment the crontab commands run it? I found this question: http://stackoverflow.com/questions/1279340/php-ssl-curl-object-moved-error but i'm using bash, not php. What are the equivalent command line options or variables to set to fix this problem in bash? (I want to do this with curl, not wget)

    Read the article

  • Is there any use for Bash scripting anymore?

    - by Precision
    I just finished my second year as a university CS student, so my "real-world" knowledge is lacking. I learned Java my first year, continued with Java and picked up C and simple Bash scripting my second. This summer I'm trying to learn Perl (God help me). I've dabbled with Python a bit in the past. My question is, now that we have very readable, very writable scripting languages like Python, Ruby, Perl, etc, why does anyone write Bash scripts? Is there something I'm missing? I know my linux box has perl and python. Are they not ubiquitous enough? Is there really something that's easier to do in Bash than in some other hll?

    Read the article

  • Install Bash completion together with distutils / pip

    - by ifischer
    I have created a simple Python module and want to distribute it with pip. I also want to install a Bash completion file together with the module. I'm installing the module with Python 2.7.1+ and pip 0.8.2. I have this setup.py: setup( name='jenkinsmon', version='0.0.1', description='Jenkins Job Monitor', long_description=open('README.txt').read(), scripts=['bin/jenkinsmon'], data_files=[ ('/etc/bash_completion.d', ['extras/jenkinsmon.completion']), ], install_requires = [ 'autojenkins', 'argparse' ], ) Now if I try to install the package with pip install -e ., the Bash completion file never gets installed together with the package. I also tried workarounds by specifying a MANIFEST.in, like described here: MANIFEST.in: include extras/jenkinsmon.completion But this also doesn't help - the completion files won't get installed. What can I do to install the Bash completion files?

    Read the article

  • How to translate small bash code to csh / tcsh (setting GNOME terminal title)

    - by user1069609
    I need help to translate the following bash code to tcsh : case $TERM in (xterm*) PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}\007"' ;; esac It is part of my .bashrc on all the machines which have bash as login shell. The code sets the GNOME terminal title to user@somehost (obviously with the real user name and host name). However some hosts have tcsh as login shell, so I need to translate the code into tcsh and add it to the .tcshrc . I considered to somehow source another file with the bash code from inside the .tcshrc file, but I couldn't make it work.

    Read the article

  • Bash script — determine if file modified?

    - by Alan H.
    I have a Bash script that repeatedly copies files every 5 seconds. But this is a touch overkill as usually there is no change. I know about the Linux command watch but as this script will be used on OS X computers (which don’t have watch, and I don’t want to make everyone install macports) I need to be able to check if a file is modified or not with straight Bash code. Should I be checking the file modified time? How can I do that? Edit: I was hoping to expand my script to do more than just copy the file, if it detected a change. So is there a pure-bash way to do this?

    Read the article

  • Renaming and Moving Files in Bash or Perl

    - by Katie
    HI, I'm completely new to Bash and StackOverflow. I need to move a set of files (all contained in the same folder) to a target folder where files with the same name could already exist. In case a specific file exists, I need to rename the file before moving it, by appending for example an incremental integer to the file name. The extensions should be preserved (in other words, that appended incremental integer should go before the extension). The file names could contain dots in the middle. Originally, I was thinking about comparing the two folders to have a list of the existing files (I did this with "comm"), but then I got a bit stuck. I think I'm just trying to do things in the most complicated possible way. Any hint to do this in the "bash way"? It's OK if it is done in a script other than bash script.

    Read the article

  • Bash commands not executed when through cron job - PHP

    - by basicxman
    Hi there! I have a cron job running a PHP script every five minutes; the PHP script executes two bash commands at the end of the script. I know the script is running due to a log file it appends to. When I run the PHP script manually via the Ubuntu Gnome Terminal both bash commands execute flawlessly; however when the PHP script is triggered via cron, the two bash commands are not ran. Any ideas? $command = 'notify-send "' . count($infoleakPosts) . ' New Posts."'; `$command`; $command = 'firefox http://example.com'; `$command`; */1 * * * * php /home/andrew/grab.php USERNAME PASSWORD # JOB_ID_1

    Read the article

  • Cygwin bash syntax error - but script run perfectly well in Ubuntu

    - by Michael Mao
    #!/bin/bash if test "$#" == "4"; then echo "$*"; else echo "args-error" >&2; fi; This little code snippet troubles me a lot when I tried to run it on both Ubuntu and Cygwin. Ubuntu runs bash version 4.0+ whereas Cygwin runs 3.2.49; But I reckon version collision shall not be the cause of this, this code runs well under fedora 10 which is also using bash version 3.+ So basically I am wondering if there is a way to code my script once and for all so there are not to have this awful issue later on. Many thanks in advance.

    Read the article

  • BASH Install Of Wordpress, Without Visiting wp-admin/install.php

    - by user916825
    I wrote this little BASH script that creates a folder,unzips Wordpress and creates a database for a site. The final step is actually installing Wordpress, which usually involves pointing your browser to install.php and filling out a form in the GUI. I want to do this from the BASH shell, but can't figure out how to invoke wp_install() and pass it the parameters it needs: -admin_email -admin_password -weblog_title -user_name (line 85 in install.php) Here's a similar question, but in python #!/bin/bash #ask for the site name echo "Site Name:" read name # make site directory under splogs mkdir /var/www/splogs/$name dirname="/var/www/splogs/$name" #import wordpress from dropbox cp -r ~/Dropbox/Web/Resources/Wordpress/Core $dirname cd $dirname #unwrap the double wrap mv Core/* ./ rm -r Core mv wp-config-sample.php wp-config.php sed -i 's/database_name_here/'$name'/g' ./wp-config.php sed -i 's/username_here/root/g' ./wp-config.php sed -i 's/password_here/mypassword/g' ./wp-config.php cp -r ~/Dropbox/Web/Resources/Wordpress/Themes/responsive $dirname/wp-content/t$ cd $dirname CMD="create database $name" mysql -uroot -pmypass -e "$CMD" How do I alter the script to automatically run the installer without the need to open a browser?

    Read the article

  • Bash: Check if file was modified since used in script

    - by Thomas Münz
    I need to check in a script if a file was modified since I read it (another application can modify it in between). According to bash manual there is a "-N" test which should report if a file was modified since last read. I tried it in a small script but it seems like it doesn't work. #!/bin/bash file="test.txt" echo "test" > $file cat $file; if [ -N $file ]; then echo "modified since read"; else echo "not modified since read"; fi I also tried an alternative way by touching another file and using if [ "file1" -nt "file2 ]; but this works only on a seconds accuracy which may under rare conditions not be sufficient. Is there any other bash-inbuilt solution for this problem or I do really need to use diff or md5sum?

    Read the article

  • How to log messages to a log file in a specific path from a bash script

    - by Erik
    How do you log messages to a log file in a specific path from a bash script? A naive implementation would be commands like: echo My message >>/my/custom/path/to/my_script.log But this probably has many disadvantages (no log rotation for example). I could use the 'logger' command, but it does not support logs in custom paths as far as I know and is not easy to configure if you have lots of bash scripts that could use a custom log file. In a scripting language like Ruby all this is quite easy: https://github.com/rudionrails/yell/wiki/101-the-datefile-adapter I could also make my own logger command based on this ruby library and call it from my bash scripts, but I guess there is already a well known solution that provides similar behavior for shell scripts?

    Read the article

  • Perl standard input with argument inside Bash

    - by neversaint
    I want to have such pipe in bash #! /usr/bin/bash cut -f1,2 file1.txt | myperl.pl foo | sort -u Now in myperl.pl it has content like this my $argv = $ARG[0] || "foo"; while (<>) { chomp; if ($argv eq "foo") { # do something with $_ } else { # do another } } But why the Perl script can't recognize the parameter passed through bash? Namely the code break with this message: Can't open foo: No such file or directory at myperl.pl line 15. What the right way to do it so that my Perl script can receive standard input and parameter at the same time?

    Read the article

  • Viewing the full Skype chat history

    - by hekevintran
    I have Skype 2.8 on Mac OS X 10.5.8. Under the the chat menu is an option called "Recent Chats". This allows me to see logs of recent chats, but not of older ones. I know the older ones are stored because they are in ~/Library/Application Support/Skype/username/chatmsg256.dbb. This file when put in a text editor has text chat information from all my previous Skype chats. It is however stored in an unknown file format that I do not know how to parse. Does Skype have a built-in log viewer (like Adium's) that I can use to access these older logs?

    Read the article

  • Cursor movement history in Vim

    - by Vi
    How can I restore cursor position in Vim as it was before scrolling, selecting or PgUp/PgDn? I'm tired of searching where I was before I scrolled up to look something at the top. Are there something like "Prev cursor position" and "Next cursor position" commands (like 'u' and 'R' for regular undo/redo)?

    Read the article

  • Trying to build a history of popular laptop models

    - by John
    A requirement on a software project is it should run on typical business laptops up to X years old. However while given a specific model number I can normally find out when it was sold, I can't find data to do the reverse... for a given year I want to see what model numbers were released/discontinued. We're talking big-name, popular models like Dell Latitude/Precision/Vostro, Thinkpads, HP, etc. The data for any model is out there but getting a timeline is proving hard. Sites like Dell are (unsurprisingly) geared around current products, and even Wikipedia isn't proving very reliable. You'd think this data must have been collated by manufacturers or enthusiasts, surely?

    Read the article

  • Script to rebuild git history, applying code cleanup to every version

    - by rjmunro
    Has anyone got a script for git that can go through the history, check out each version, apply a cleanup script, then check the cleaned version into another repository? I have some code which I've been developing, but I haven't been consistent with code formatting e.g. tabs vs spaces etc. I'd like to rewrite my entire history to be consistent with the new standards.

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >