Search Results

Search found 5228 results on 210 pages for 'bash alias'.

Page 19/210 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • find: missing argument to -exec in bash script

    - by Mephi_stofel
    The following works fine when I type it exactly in the command line: find /<some_path>/{epson,epson_laser,epson_inkjet} -iname "*.ppd" -exec grep "\*ModelName\:" {} \; | sed 's/.*\"\(.*\)\"/\1/' However, when I try to call the following from a bash script I get find: missing argument to -exec'. I have also tried the following (in many variants): eval find "$1" -iname "*.ppd" -exec 'bash -c grep "\*ModelName\:" "$1" | sed "s/.*\"\(.*\)\"/\1/" \; as was mentioned in find-exec-echo-missing-argument-to-exec.

    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

  • how do I concatenate a regex in a bash alias?

    - by Rodreegez
    Hello, I can't for the life of me how to create an alias that will switch to a given project directory. I keep all my projects in a folder called Projects i.e. ~/Project/blog ~/Project/whatever I'd like to have an alias along the lines of p whatever that would equate to cd ~/Project/$1 where $1 is whatever is given to p. I have tried various combinations of alias p="cd ~/Projects/\$1" with all the usual suspects for regex escaping but I can't quite get it. Any ideas?

    Read the article

  • The Alias directive ... will probably never match because it overlaps an earlier Alias.

    - by mmattax
    I'm getting this warning from Apache: The Alias directive in /etc/httpd/conf.d/foo.conf at line 10 will probably never match because it overlaps an earlier Alias. However the Alias overlaps on a completely different virtual host. Might this be caused because one alias is on a name-based virtual host while the other alias is on an IP-based virtual host? Everything is working fine, just the warning is a bit annoying...

    Read the article

  • Apache/PHP - alias outgoing URL

    - by Dan
    In my PHP code I've got references to a URL on another website. I'm testing my website locally (using XAMPP). Is it possible to get Apache to automatically replace the domain of this other website for localhost? For example my PHP code might be: <?php echo "<a href='http://www.othersite.com'>Click me</a>"; ?> And I'd like for my local Apache to alias this to <?php echo "<a href='http://localhost'>Click me</a>"; ?> Is this possible? Cheers, Dan.

    Read the article

  • Exclude string from wildcard in bash

    - by Peter O'Doherty
    Hi, I'm trying to adapt a bash script from "Sams' Teach Yourself Linux in 24 Hours" which is a safe delete command called rmv. The files are removed by calling rmv -d file1 file2 etc. In the original script a max of 4 files can by removed using the variables $1 $2 $3 $4. I want to extend this to an unlimited number of files by using a wildcard. So I do: for i in $* do mv $i $HOME/.trash done The files are deleted okay but the option -d of the command rmv -d is also treated as an argument and bash objects that it cannot be found. Is there a better way to do this? Thanks, Peter #!/bin/bash # rmv - a safe delete program # uses a trash directory under your home directory mkdir $HOME/.trash 2>/dev/null # four internal script variables are defined cmdlnopts=false delete=false empty=false list=false # uses getopts command to look at command line for any options while getopts "dehl" cmdlnopts; do case "$cmdlnopts" in d ) /bin/echo "deleting: \c" $2 $3 $4 $5 ; delete=true ;; e ) /bin/echo "emptying the trash..." ; empty=true ;; h ) /bin/echo "safe file delete v1.0" /bin/echo "rmv -d[elete] -e[mpty] -h[elp] -l[ist] file1-4" ;; l ) /bin/echo "your .trash directory contains:" ; list=true ;; esac done if [ $delete = true ] then for i in $* do mv $i $HOME/.trash done /bin/echo "rmv finished." fi if [ $empty = true ] then /bin/echo "empty the trash? \c" read answer case "$answer" in y) rm -i $HOME/.trash/* ;; n) /bin/echo "trashcan delete aborted." ;; esac fi if [ $list = true ] then ls -l $HOME/.trash fi

    Read the article

  • Table alias has an effect with execution time?

    - by RedFux227
    So I have this query : SELECT A.e_cd "INFLATE" , A.ccgpt "1" , ( SELECT J.comp FROM JBB J WHERE J.e_cd=A.e_cd AND emplo_RCD=:1 AND J.Dte = ( SELECT MAX(J1.Dte) FROM JBB J1 WHERE J.e_cd=J1.e_cd AND TO_CHAR(J1.Dte,'MM') <=A.mth_to AND TO_CHAR(J1.Dte,'YYYY') <=A.year ) AND J.seq = ( SELECT MAX(J2.seq) FROM PS_JOB J2 WHERE J2.e_cd=J.e_cd AND J2.Dte=J.Dte)) "Company" FROM PPS A WHERE orcd=:2 AND rcd=:3 AND tx_cd=:4 AND year=:5 With this one : SELECT A.e_cd "INFLATE" , A.ccgpt "1" , ( SELECT J.comp FROM JBB J WHERE J.e_cd=A.e_cd AND emplo_RCD=:1 AND J.Dte = ( SELECT MAX(J1.Dte) FROM JBB J1 WHERE J.e_cd=J1.e_cd AND TO_CHAR(J1.Dte,'MM') <=A.mth_to AND TO_CHAR(J1.Dte,'YYYY') <=A.year ) AND J.seq = ( SELECT MAX(J1.seq) **FROM PS_JOB J1 WHERE J1.e_cd=J.e_cd AND J1.Dte=J.Dte**)) "Company" FROM PPS A WHERE orcd=:2 AND rcd=:3 AND tx_cd=:4 AND year=:5 The 1st query run for about 3.20 sec with buffer gets 8,134 and for the 2nd query it run for about 1.73 sec with buffer gets 7,006. So, is the table alias somehow has an impact on the execution time / buffer gets? Thanks in advance!

    Read the article

  • git undo alias with xargs

    - by ABach
    I have a git alias (git undo) that undoes everything in the working directory, including new files, changed files, and deleted files: !git reset --hard && git ls-files -d | xargs -0 git rm --ignore-unmatch && git clean -fq On OS X, this works great. On Linux, however, I run into the following issue: if no files have been deleted from the repository, the git ls-files -d | xargs -0 git rm --ignore-unmatch command will fail (xargs will be passed nothing). Is there a way to have xargs silently move on if it receives nothing from git ls-files?

    Read the article

  • alias some columns names as one field in oracle's join select query

    - by Marecky
    Hi We are developing something like a social networking website. I've got task to do 'follow me' functionality. In our website objects are users, teams, companies, channels and groups (please don't ask why there are groups and teams - it is complicated for me too, but teams are releated to user's talent) Users, teams, channels, companies and groups have all their own tables. I have a query which gets me all the follower's leaders like this select --fo.leader_id, --fo.leader_type, us.name as user_name, co.name as company_name, ch.title as channel_name, gr.name as group_name, tt.name as team_name from follow_up fo left join users us on (fo.leader_id = us.id and fo.leader_type = 'user') left join companies co on (fo.leader_id = co.user_id and fo.leader_type = 'company') left join channels ch on (fo.leader_id = ch.id and fo.leader_type = 'channel') left join groups gr on (fo.leader_id = gr.id and fo.leader_type = 'group') left join talent_teams tt on (fo.leader_id = tt.id and fo.leader_type = 'team') where follower_id = 83 I need to get all fields like: user_name, company_name, channel_name, group_name, team_name as one field in SELECT's product. I have tried to alias them all the same 'name' but Oracle numbered it. Please help :)

    Read the article

  • Bash script not working on a new dedicated server

    - by Scott
    Recently I have migrated to the new dedicated server which is running on the same operating system - FreeBSD 8.2. I got a root account access and all permissions have been set properly. My problem is that, the bash script I was running on the old server doesn't works on the new machine, the only error appearing while running the script is: # sh script.sh script.sh: 3: Syntax error: word unexpected (expecting ")") Here is the code itself: #!/usr/local/bin/bash PORTS=(7777:GAME 11000:AUTH 12000:DB) MESSG="" for i in ${PORTS[@]} ; do PORT=${i%%:*} DESC=${i##*:} CHECK=`sockstat -4 -l | grep :$PORT | awk '{print $3}' | head -1` if [ "$CHECK" -gt 1 ]; then echo $DESC[$PORT] "is up ..." $CHECK else MESSG=$MESSG"$DESC[$PORT] wylaczony...\n" if [ "$DESC" == "AUTH" ]; then MESSG=$MESSG"AUTH is down...\n" fi if [ "$DESC" == "GAME" ]; then MESSG=$MESSG"GAME is down...\n" fi if [ "$DESC" == "DB" ]; then MESSG=$MESSG"DB is down...\n" fi fi done if [ -n "$MESSG" ]; then echo -e "Some problems ocurred:\n\n"$MESSG | mail -s "Problems" [email protected] fi I don't really code in bash, so I don't know why this happend...

    Read the article

  • How to make bash script run with a latency (i.e. wait 1 sec at each iterations)?

    - by user2413
    I have this bash script; for (( i = 1 ; i <= 160 ; i++ )); do qsub myccomputations"${i}".pbs done Basically, I would prefer if there was a 1 second delay between each iteration. The reason is that at each iterations, it sends the program file mycomputation"${i}$.pbs to a core node for solving. Solving in this instance involves the use of pseudo random numbers. I suspect the RNG I use (R's) uses CPU time as seed because as things are now I get repeating pseudo random numbers (at the rate of approx 1 out of 100). So how to you ask bash to for (( i = 1 ; i <= 160 ; i++ )); do wait 1 sec qsub myccomputations"${i}".pbs done

    Read the article

  • Bash vs. Gnu screen : Replace Ctrl-A with Ctrl-Shift-A

    - by Stefan Lasiewski
    I'm a new user to GNU Screen. I've been using Bash for a very long time, and I want to give GNU Screen a try. As you know, GNU Screen uses 'C-a' (Control-A) as as the command character. Trouble is, this interferes with the Line Editing feature in Bash (and GNU Readline), because Control-A in Bash will Move to the start of the line." I know I can set the Command Character to another key sequence, like "^Q" or "``" (Backtick), but I have trouble finding another key sequence which isn't already in use (^Q is used by the terminal, backtick is used when writing shell scripts). It appears that the Command Character may only be one or two characters in length. Can I set the GNU Screen control character to be something like "Control-Shift-A"? (I can't use more then one hyperlink yet, so I cannot link to the Bash documentation)

    Read the article

  • How can I see Bash history from more than one terminal session in Ubuntu?

    - by Sanoj
    I use Ubuntu 9.10 and I would like to be able to see my bash history for more than one terminal sessions. I.e. my last 200 commands or so, even if I have been logged out in between. When I use the history I just see all commands from my actual terminal session. How can I see more command history from Bash? Is there any specific settings for bash that I should change from the default values in Ubuntu?

    Read the article

  • bash starts replacing the characters on the current line insead of moving over to the next line

    - by Lazer
    I use bash shell $ bash --version GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. $ Sometimes, when typing a command on the prompt that is pretty lengthy and does not fit in the current line, instead of displaying the extra characters on the next line, bash starts again on the current line.. replacing the characters that were there and making a mess. what should happen : |---------------------------------------------| | $ my big long command takes a lot of argumen| | s and does not fit in a single line | | | |---------------------------------------------| what happens instead : |---------------------------------------------| | s and does not fit in a single linef argumen| | | | | |---------------------------------------------| The issue is intemittent If I resize my shell window to really small width, normal behaviour is restored Does anyone have any idea what is happening here? $ echo $TERM xterm $ echo $PS1 \[\e[30m\][\t]\[\e[0m\]\[\e]0;\w\a\]\[\e[30m\][\W]$ $

    Read the article

  • Does bash have a hook that is run before executing a command?

    - by Gilles
    In bash, can I arrange for a function to be executed just before running a command? There is $PROMPT_COMMAND, which is executed before showing a prompt, i.e., just after running a command. Bash's $PROMPT_COMMAND is analogous to zsh's precmd function; so what I'm looking for is a bash equivalent to zsh's preexec. Example applications: set your terminal title to the command being executed; automatically add time before every command.

    Read the article

  • When to use Bash, when Python/Perl/Ruby? [closed]

    - by futlib
    What's your rationale for when to write a Bash script and when to use a more powerful scripting language (Python, Perl, Ruby, ...)? I'm finding that very simple scripts are nicer with Bash, but many of those get quite fancy over time, and it never seems like a good idea to rewrite the whole thing. That's why I'm leaning towards always using Python for all scripting. But since Bash seems to be the the lingua franca of Linux scripting, is that something a responsible system administrator would do?

    Read the article

  • Bash child proccess PID - how do you get it?

    - by Jason Tan
    Can any one tell me how to get the PID of a command executed in bash. E.g. I have a bash script that runs imapsync. When the script is killed the imapsync process does not always get killed, so I'd like to be able to identify the PID of imapsync programatically from my script, so that I can kill the imapsync process myself in a signal handler. So how do I programatically get the PID of a child process from a parent bash script? Thanks Folks

    Read the article

  • How can I upgrade bash to >= 4.1 on CentOS 5.5?

    - by Agvorth
    I have a CentOS 5.5 VPS server. I want to use RVM. According to the console output when I run the RVM installer, RVM requires bash = 4.1. I just ran yum update. My bash version is now 3.2.25. If I understand how yum works, that means that 3.2.25 is sort of the version of bash that "belongs with" my CentOS version, and it's the latest version I can get using yum. (Right? Or am I wrong about this?) How can I get that on my CentOS 5.5 system? To clarify, I understand that I can just download the source and install, but I'm hesitant to break out of yum's version management system. Is there a way to upgrade bash without disrupting yum?

    Read the article

  • how to copy the results from a grep command to the bash clipboard?

    - by avilella
    If I type something in a Linux bash terminal with no X, and then use Ctrl+u, whatever I typed is stored in the bash "clipboard" (for lack of a better term), and I can type it again doing Ctrl+y. How can I copy the results from a grep command on a text file to such bash clipboard? For example, if I have an INSTALL file like this: ./installprocedure --do-some-long-and-complicated-operation-on-dir dir1 How can I copy the content of a grep command so that it's available doing Ctrl+y? For example: copy content to bash clipboard "grep installprocedure INSTALL" Ctrl+y ./installprocedure --do-some-long-and-complicated-operation-on-dir dir1 #cursor available here

    Read the article

  • Password protect an alias virtual difrecory

    - by Jason
    I have a main domain being hosted through CPanel. I also have a sub-domain that I would like to appear as a path under the main domain instead of as a sub-domain. So I have: http://example.com/ pointing to the main hosted file. http://example.com/mydir pointing to the subdomain files. This is achieved by a httpd.conf include from the main domain section to set an alias: alias /mydir /path/to/subdomain/files/ Now, that works fine so far. The problem is that if a .htaccess file under /path/to/the/subdomain/files/ contains an error, the alias is completely skipped, and /mydir goes instead to the main host files. That is kind of surprising to me - I would expect an error to return an error instead. Now the killer: if I try to password protect /path/to/subdomain/files/, then trying to access http://example.com/mydir will again attempt to deliver from under the main hosted files and not from /path/to/subdomain/files/ I am not seeing any errors reported on the .htaccess file in the apache error log, so I am assuming the .htaccess is valid: AuthUserFile /path/to/valid/readable/.htpasswd AuthName "Secure Access" AuthType Basic Require valid-user This kind of behaviour does not seem right to me. Is there something obvious that could be causing it? Or is this just the way it works? Perhaps using an alias is the wrong way to go?

    Read the article

  • Password protect an alias virtual directory

    - by Jason
    I have a main domain being hosted through CPanel. I also have a sub-domain that I would like to appear as a path under the main domain instead of as a sub-domain. So I have: http://example.com/ pointing to the main hosted file. http://example.com/mydir pointing to the subdomain files. This is achieved by a httpd.conf include from the main domain section to set an alias: alias /mydir /path/to/subdomain/files/ Now, that works fine so far. The problem is that if a .htaccess file under /path/to/the/subdomain/files/ contains an error, the alias is completely skipped, and /mydir goes instead to the main host files. That is kind of surprising to me - I would expect an error to return an error instead. Now the killer: if I try to password protect /path/to/subdomain/files/, then trying to access http://example.com/mydir will again attempt to deliver from under the main hosted files and not from /path/to/subdomain/files/ I am not seeing any errors reported on the .htaccess file in the apache error log, so I am assuming the .htaccess is valid: AuthUserFile /path/to/valid/readable/.htpasswd AuthName "Secure Access" AuthType Basic Require valid-user This kind of behaviour does not seem right to me. Is there something obvious that could be causing it? Or is this just the way it works? Perhaps using an alias is the wrong way to go?

    Read the article

  • How to get the cursor position in bash ?

    - by Julien Nicoulaud
    In a bash script, I want to get the cursor column in a variable. It looks like using the ANSI escape code {ESC}[6n is the only way to get it, for example the following way: # Query the cursor position echo -en '\033[6n' # Read it to a variable read -d R CURCOL # Extract the column from the variable CURCOL="${CURCOL##*;}" # We have the column in the variable echo $CURCOL Unfortunately, this prints characters to the standard output and I want to do it silently. Besides, this is not very portable... Is there a pure-bash way to achieve this ?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >