21 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for AndrisP

How i can `sed` save pattern matches to variables and do something with it? eg $ echo "string_4.3.2" | sed 's/^string_\([0-9]\)\.\([0-9]\)\.\([0-9]\)$/\1 \2 \3/' output "4 3 2" but I want to pass variables to function eg do_something() { echo $1 echo $2 echo $3 # ..... # ..... } string="string_4.3.2" …

Member Avatar for AndrisP
0
821
Member Avatar for Dean_5

What it says on the tin. When the system (without logging into X) detects a change in internet accessibility, I'd like to set a hook to execute a script. EDIT: Every single bloody time... So, [dhcpcd-run-hooks](http://roy.marples.name/man/html8/dhcpcd-run-hooks.html) exists... is that the preferred method or can anyone recommend something else that's - …

0
286
Member Avatar for Nathan_6

Hello everyone. I realize that this may be an elementary question, but all of my searches for answers have not given me a satisfactory result. In my ubuntu server machine, I typed in [after examining my stty settings] `werase='^I'` as I was configuring the terminal to my likings. All was …

Member Avatar for Nathan_6
0
1K
Member Avatar for lewashby

garrett@mint-desktop /var/www/html/udemy/php-oop/gallery/backups $ tar --exclude-tag-all=backups -cf lesson20.tar ../* tar: Removing leading `../' from member names I have an empty file called backups in my backups directory to keep the tar file from trying to backup itself. Does anyone know why I'm getting this output? -> `tar: Removing leading ../' from …

Member Avatar for Gribouillis
0
452
Member Avatar for it@61@sec

I have a C++ program with a main routine which reads arguments from command line: int main(int argc, const char *argv[]) In my system I have defined some aliases in my bash environment which abbreviates directory names. Example: alias dst='home/username/Documents/test' alias src='home/username/Download/test' My program is called "dircopy" and I want …

Member Avatar for it@61@sec
0
307
Member Avatar for cjohnweb

Hello! I am normally in the PHP / Web Development section of DaniWeb. It's a pleasure to finally have a reason to check out other sections of DaniWeb! So, I am logged in as root at the Command Line Interface over SSH - on Debian 7 Wheezy running on a …

Member Avatar for cjohnweb
0
336
Member Avatar for naphets

I have a bash script that executes @ init level 3. I would like to "wrap" (for lack of better word) this bash script in a php script. Use the power of php to supress any output from the bash. Also display only the splash logos (like what you see …

Member Avatar for naphets
0
441
Member Avatar for replic

Hello everyone, i am fairly new to shell scripting so please bear with me. The following script is supposed to read words from a file and depending on the word print different things. However it always prints the default value. It also refuses to work completely if the first line …

Member Avatar for replic
0
332
Member Avatar for jpreem

So Im using our university servers through an ssh connection. I have a bunch of files in a directory which I would like to run through a perl script. So I thought this simple script I concocted should do the trick. I have used similar script on my home computer …

Member Avatar for TylerD75
0
297
Member Avatar for it@61@sec

I have a bash script (test.sh) which reads parameters from the command line. The parameters could look like this: param1 param2 param3&ext param4 param5 The problem is that when the script reads the parameters and then echo them I get the following: param1 param2 param3 No command 'ext' found did …

Member Avatar for it@61@sec
0
967
Member Avatar for iamthesgt

I am using Awk inside a bash shell script to search header files for c++ functions so I can add these functions to another file. All of the functions I need will have form: type getName() or type setName(type value) Right now I get all the functions listed in between …

Member Avatar for iamthesgt
0
448
Member Avatar for dancks

I was supposed to write a program that reads and writes phone numbers of people to a file called phones.txt. The reading part works. The write part doesn't. I tried to use the cat command because I thought doing cat >> file.txt would simply append to a file. What it …

Member Avatar for dancks
0
371
Member Avatar for iamthesgt

This is homework. I was writing a bash script that accepts a list of group names on the command line and produces a group report detailing the group id and the number of group members identified in /etc/passwd for each group. Output will look like: Group Report Group GID Count …

Member Avatar for iamthesgt
0
303
Member Avatar for Sudo Bash

Hi, I was wanting to write a (ba)sh script to allow me to wait for the detection of a new USB device, and when that device is detected, execute some commands. The scripts are intending to be working on the principle that whenever I plug in a usb device a …

Member Avatar for Sudo Bash
0
241
Member Avatar for winecoding

I am trying to understand one test script, which includes [CODE]if [ ! -f mahout-work/reuters21578.tar.gz ]; then echo "Downloading Reuters-21578" curl http://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz \ -o mahout-work/reuters21578.tar.gz fi[/CODE] What does the condition of [CODE]! -f mahout-work/reuters21578.tar.gz [/CODE]mean? And what does [CODE]curl http://kdd.ics.uci.edu/databases/reuters21578/reuters21578.tar.gz \ -o mahout-work/reuters21578.tar.gz [/CODE]stand for? Thanks.

Member Avatar for alaa sam
0
244
Member Avatar for kristo5747

After running the command [CODE] find . -name "R*VER" -mtime +1 -exec sh -c 'grep -H ^err "{}" || echo "{}:No error"' \;[/CODE] my files look like this [CODE] RRR1~COS~COSMETICS~40048~jgmdtv113~1~P~R22-200~029053662549~20110607~102151.VER No error RRR1~COS~COSMETICS~ETT03~jgm14652.~3~F~R16-500~000907009757~20110607~085109.VER err 3922 [/CODE] Using the tilde (~) symbol as delimiter in the file name, can I extract …

Member Avatar for kristo5747
0
210
Member Avatar for airbourne

I am writing a simple shell script to automate a simple backup of a website and it's database. This is the working code: [CODE]#!/bin/bash # creates a backup of the mysql & webdata for a specific website. TODAY=`date +%A` # these variables cannot contain any spaces and must be modified …

Member Avatar for L7Sqr
0
700
Member Avatar for Jamesbch

Hello, I'm kinda weird I know but I'm trying to encode my mp3 to a lower quality (for my mobile phone) with one line of shell (with bash). I'm wasting some more time as I would do by hand but I'm very interested. Here is my not-working line : [CODE]find …

Member Avatar for ole.tange
0
344
Member Avatar for niall_heavey

Hi, I am trying to delete all files that end in .csv within a directory. I'm not sure how to go about this, I am using bash and the command I used was; [CODE]rm '/home/eeng/ME_project/Big_Users/*.csv'[/CODE] New to this scripting so not too sure where i'm going wrong. Any ideas? Thanks. …

Member Avatar for cfajohnson
0
160
Member Avatar for daryll1

Hi, as a bit of background, My Uni have lately implemented a CGI script so you have to log in to be able to use the wireless. This would be OK but they are terrible programmers and instead of timing out after a period of inactivity it will time out …

0
129
Member Avatar for Kruptein

How can I start a launcher from python? if I do: [icode]os.system("~/localhost")[/icode] it just returns a number (probably a process id or something) if this is not possible, how can I start from python a terminal window and execute a code in that terminal? (without closing the python script) Thanks …

Member Avatar for Kruptein
0
198

The End.