Search Results

Search found 3730 results on 150 pages for 'bash'.

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

  • [bash] Escape a string for sed search pattern

    - by Alexander Gladysh
    In my bash script I have an external (received from user) string, which I should use in sed pattern. REPLACE="<funny characters here>" sed "s/KEYWORD/$REPLACE/g" How can I escape the $REPLACE string so it would be safely accepted by sed as a literal replacement? NOTE: The KEYWORD is a dumb substring with no matches etc. It is not supplied by user.

    Read the article

  • php vs bash for CLI scripting?

    - by fayer
    i have never used PHP with CLI, but i have seen scripts run with php code. i was wondering, why should we use bash, when php is so popular and is able to run in CLI. what are the pros and cons with each one? should i use php for all CLI scripting in the future?

    Read the article

  • Variable assignment in bash

    - by Werner
    Hi, this is probably a very stupid question; in a bash script, given the output of, for instance; awk '{print $7}' temp it gives 0.54546 I would like to give this to a variable, so I tried: read ENE <<< $(awk '{print $7}' temp) but I get Syntax error: redirection unexpected Could you tell me why, and what is the easiest way to do this assignment? Thanks

    Read the article

  • Source operator doesn't work in if construction in bash

    - by Igor
    Hello, I'd like to include a config file in my bash script with 2 conditions: 1) the config file name is constructed on-the-fly and stored in variable, and 2) in case if config file doesn't exist, the script should fail: config.cfg: CONFIGURED=yes test.sh: #!/bin/sh $CFG=config.cfg echo Source command doesn't work here: [ -f $CFG ] && ( source $CFG ) || (echo $CFG doesnt exist; exit 127) echo $CONFIGURED echo ... but works here: source $CFG echo $CONFIGURED What's wrong in [...] statement?

    Read the article

  • Command to escape a string in bash

    - by User1
    I need a bash command that will convert a string to something that is escaped. Here's an example: echo "hello\world"|escape|someprog Where the escape command makes "hello\world" into "hello\\world". Then, someprog can use "hello\world" as it expects. Of course, this is a simplified example of what I will really be doing.

    Read the article

  • [bash] files indexed by production date

    - by caas
    Each day an application creates a file called file_YYYYMMDD.csv where YYYYMMDD is the production date. But sometimes the generation fails and no files are generated for a couple of days. I'd like an easy way in a bash or sh script to find the filename of the most recent file, which has been produced before a given reference date. Typical usage: find the last generated file, disregarding those produced after the May 1st. Thanks for your help

    Read the article

  • symbols in command line argument.. python, bash

    - by Idlecool
    Hi, I am writing a python script on Linux for twitter post using API, Is it possible to pass symbols like "(" ")" etc in clear text without apostrophes.... % ./twitterupdate this is me #works fine % ./twitterupdate this is bad :(( #this leaves a error on bash. Is the only alternative is to enclose the text into -- "" ?? like.. % ./twitterupdate "this is bad :((" #this will reduce the ease of use for the script Is there any workaround?

    Read the article

  • SVN: and bash: How to tell if there are uncommitted changes

    - by fishtoprecords
    I'm trying to wrap a standard sequence of steps in a shell script (linux/bash) and can't seem to figure out how to tell of the execution of svn status returned anything. For example ~/sandbox/$svn status ? pat/foo ~/sandbox/$echo $? 0 If I delete the foo file, then the svn status return nothing, but the echo $? is still 0 I want to not do some steps if there are uncommitted changes. Pointers greatly appreciated.

    Read the article

  • Reading a subset of the lines in a text file, with bash

    - by Markus
    Hi! I have a file line a - this is line a line b - this is line b line c - this is line c line d - this is line d line e - this is line e The question is: How can I output the lines starting from "line b" till "line d" using bash commands? I mean, to obtain: "line b - this is line b line c - this is line c line d - this is line d"

    Read the article

  • How to create a CPU spike with a bash command

    - by User1
    I want to create a near 100% load on a Linux machine. It's quad core system and I want all cores going full speed. Ideally, the CPU load would last a designated amount of time and then stop. I'm hoping there's some trick in bash. I'm thinking some sort of infinite loop.

    Read the article

  • List files that don't match a string in bash

    - by Javier
    Dear all, I'm a newbie in bash and I would like to pass as parameter to a python function all files in a directory that don't match a given pattern. sth. like: $myscripts/myprog.py $myfiles/!(bonjovi) The above example should retrieve all files that don't match to "bonjovi". Best wishes

    Read the article

  • bash split text into limited character buckets (array member)

    - by soField
    i have text such as http://pastebin.com/H8zTbG54 we can say this text is set of rules splitted by "OR" at the end of lines i need to put set of lines(rules) into buckets (bash array members) but i have character limit for each array member which is 1024 so each array member should contain set of rules but character count for each array member can not exceed 1024 can anybody help me to do that solaris 10

    Read the article

  • Get color output in bash

    - by Werner
    Hi, when compiling some projects on linux terminal, I get usually a long output consisting of a lot of information. Usually this information is MONOCHROME. I wonder if bash can be modified somehow, so in all outputs or in some specific outputs (like from Makefile, etc) I can get different colors dependeing on, for instance: make[1]: Leaving directory or g++ -DHAVE_CONFIG_H -I. etc. Thanks

    Read the article

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