0
votes
1answer
30 views

Running a script from ssh, logging out and continuing the script

The overall question here is - how do I automate sshing into a machine, running a script, and exiting without killing the script? I know that this has been answered several times, but I'm not having ...
1
vote
1answer
21 views

How do I identify shell script execution vs dot execution

I'm writing a bash script that needs to run on the current process for it to be useful. That is, I want to make sure that the script was invoked with source script.sh or . ./script.sh and not ...
1
vote
0answers
17 views

Creating multiple screens in a for loop to run parellel programs and sending commands to each

Before flagging this questions as redundant, i have read and tried every answer to similar questions with no success I have this loop where it traverses a directory structure, and runs a program ...
0
votes
1answer
28 views

Interact with remote “shell” from background script via SSH

I need to emulate the following with a script which is invoked by a web service run from a Linux server: Access remote AIX server via SSH Log into a Cache instance (if that's unfamiliar, pretend ...
0
votes
2answers
30 views

Linux move files from specific directory one directory up and delete empty folder

I need to move files out from directory inside directory inside directory and remove folder that i move them from. I would need recursive script. Directory structure: ...
0
votes
1answer
44 views

How to extract the filename without the extension from a full path?

I'm trying to right my first bash script, and at one point a filename is passed to the script as $1. I need to extract the file name without the extension. Currently, I'm assuming that all extensions ...
3
votes
1answer
50 views

#!/bin/bash -e :: what is `-e`? other arguments?

I am a shell script coder that always opt to use shell as top level as part of my belt in creating website apps on the fly and have relied on my bash scripts if I want a project to be implemented ...
0
votes
1answer
42 views

input from shell in bash script

i have a bash script i would like modify to support input from shell atm i have to type the link after i have run the script wiak@test:~$ scripts/lget.sh gimme cookie! ...
0
votes
0answers
18 views

How to backup incremental with rsync with diffrent location for incremental changes?

I want to do incremental backup with rsync in centos. but I want to have a full backup in a specific folder and for incremental changes I use to another folder with time stamp. Is it possible and how? ...
12
votes
8answers
901 views

Bash Script to repeat every word in a line?

I have a string like: dog cat bird whale And I want to get dog dog cat cat bird bird whale whale All the words are in the same line. Any idea?
2
votes
2answers
38 views

quotes around filenames confuse bash script

I am writing a script that applies a command to loads of files. The way I automate this boils down to #!/bin bash for in_file in ${PWD}/*/*/*.txt; do out_file="${in_file//in/out}" ...
1
vote
3answers
40 views

Is there a tool that could help me use my Linux scripts in Windows? [duplicate]

I am new here. I would like to know if there is a tool that would help me use my Linux scripts in Windows? I am more comfortable with Linux commands than Windows. I also tried to download a software ...
0
votes
0answers
63 views

find command with exec sh doesn't work in shell script but in commandline (raspberrypi)

I want to find "old" folders in /volume1/photo/ipcam which are named like "????-??-??" and move corresponding folders within dropbox (with the same directory structure /ipcam/...) to the subfolder ...
1
vote
1answer
70 views

How to create destination directory structure dynamically when using mv with wildcards in bash?

I'm pretty new to BASH scripting and I'm looking for an elegant way to solve my task: In a given directory certain files regularly have to be sorted into subfolders. The name of the files has a fixed ...
0
votes
0answers
16 views

goto inside alias is working only in one way

Why this is not working? #!/bin/csh goto skip_background run_in_background2: echo inside background goto back_from_backgroung skip_background: echo skipped alias run_in_backgroundx 'echo aliass \ ...
0
votes
1answer
28 views

Linux firing subshell and stopping whole script

How to make it work? #!/bin/csh newgrp user_grp2 echo ok "echo ok" is not executed until I write exit in the console. This is sample code. How to make it work? I ask in another way: when i run ...
2
votes
2answers
70 views

Is it possible to execute scripts on embedded linux devices (i.e: DSL routers)?

Folks, I wanna find a generic way to run a (simple bash) script on boot sequence of a router with embedded Linux. I have read about ways to do this on devices like: DD-WRT OpenWRT any NAS like ...
0
votes
1answer
666 views

How to make PuTTY's font automatically change color (while connected to a Linux server) as I did with Windows cmd.exe using a background batch script?

I was able to create a Windows Command Prompt that automatically changes its text color on a white background every ~1.5 seconds, thanks to the help of @dbenham and @Woody. I also use PuTTY every day, ...
0
votes
0answers
43 views

Keep music library (apple lossless) in sync and converted as another format (flac)

My music library is arranged like: /data/music/Artist_-_Album[alac]/*.m4a I need to be able to keep a copy of these in another format (apple lossless) and I'd want that like: ...
0
votes
1answer
52 views

Bash two text files comparision script

Given two files, I want to write a shell script that reads each line from file1 and checks if it is there in file2. If a line is not found in file2 it should keep it lets say in a table TAB1. Also, if ...
0
votes
1answer
61 views

Simple bash gpg update script

I have a text file in which I save all my important personal data like all my accounts' passwords and my credit cards' PINs in case I forget those. Obviously, that file needs to be encrypted, so I ...
0
votes
0answers
61 views

Script bash start new process

Every time I run a bash script or a binary, it creates a new process and a messy display, the output text comes only when the process is done. I don't understand why it behaves this way, I would like ...
0
votes
1answer
45 views

How to let any user without root change specific network(qdisc) settings?

I have made a simple router from a Linux PC, for the purpose of simulating poor network conditions using qdisc (netem and tbf). Now, I want to allow any user to activate specific presets that I have ...
0
votes
1answer
36 views

How can I run a command at login?

I would like to run a command at login on my Fedora 19 GNU/Linux system. What is the best way to do this? Note: i am using the GUI. Thus, I could not simply place the commands in my .zshrc file. They ...
1
vote
0answers
142 views

Automatically mounting an encrypted USB disk at boot

I've followed these steps to set up an encrypted USB hard disk on Lubuntu 13.10, and these to unlock it with a keyfile instead of a passphrase. I now have a disk ...
0
votes
2answers
113 views

How can I run a command after boot? [duplicate]

I would like to run the simple shell command echo 1 > /proc/sys/kernel/sysrq at each boot, to enable the sysrq keys. When in boot should this be done, and where should I put a script to do it?
0
votes
0answers
50 views

Linux flow control exit or break on condition

I have a query about the following flow control. I need help to run a script that has these three conditions: Conditions: Successful: Proceed to read message. Fails: Exit to cat or just exit ...
0
votes
2answers
37 views

Globally value not getting changed and also script not getting load

Basically I have to ask two questions through this explanation. I am using Red Hat Linux 6.0 ... using davinchi board. I have to change system clock resolution so I am changing HZ env var. For this I ...
0
votes
1answer
55 views

I do not understand -printf script

I have taken over the responsibility of RHEL5 scripting and I've not had any training in this platform or bash scripting. There's a script that has multiple pieces to it and I will ask only about the ...
1
vote
1answer
324 views

Running remote scripts on Linux Servers from Windows

I'm on a Windows server, I'm looking for a way to run some scripts (through RSH?) remotely on Linux servers. Thing is, I have to do a lot of stuff manually on different servers whenever I want to ...
0
votes
1answer
45 views

Why is this awk statement not working?

awk 'BEGIN { COLM_FMT = "%-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s,\n" } { printf COLM_FMT, ${totals[0]}, ${totals[1]}, ${totals[2]}, ...
1
vote
0answers
91 views

Linux: Trying to find files from a list recursively and copy them somewhere else

I'm trying to find files from a list and copy them to another place. So I started my test loop like that: # cat ~/my_filelist.txt | while read file ; do echo "$file" ; done After I hit enter all ...
-1
votes
1answer
91 views

How to allow user to input file names in bash script

I've got this script I called it "r1": for f in "$@" do fpath=`dirname "$f"` file=`basename "$f"` arc=$fpath"/"$file".rar" rar a -v1024000 -r -m0 -ep1 -o- "$arc" "$f" done It works well but I am ...
1
vote
1answer
176 views

What is the easiest way to turn a list of music files into a playlist

I recently switched from windows to linux and the player I was using in windows stored the rating for flac files inside an id3v2 files which clementine, my preferred linux media player, cannot read. ...
1
vote
4answers
630 views

Linux: Run command on a batch of files, with matching output files

A simple task: given a directory of files and a command that takes one file as input and produces one file as output, I want to process all the files in a directory at once and output them with ...
1
vote
3answers
158 views

Take all files in dir and for each file do the same perl procedure

I have dir, where are multiple files. a1, bb2, ccc3 At the moment I manually do: perl myperscitpt.pl a1 a1.txt perl myperscitpt.pl bb2 bb2.txt perl myperscitpt.pl ccc3 ccc3.txt How could I do ...
0
votes
1answer
122 views

Converting Windows batch to Linux script (Batch create symbolic links by first character)

As a noob to Linux and scripting I'm unsure as to how to convert this into a linux script or even where to start. Essentially I want to create a script that creates alphabetized folders A-Z, symlink ...
1
vote
1answer
395 views

wget execute script after download

I need every time you complete a transfer program wget this run a script. this is my full command line: wget -i urls-to-downloads.txt My problem is that I want to go subtracting it downloads the ...
0
votes
1answer
69 views

How do you determine if you're on a linux or BSD system inside a script?

I've got a rather extensive selection of dotfiles thats been kept in a git repo for the longest time - I just maintain a separate branch of code for bsd-isms (for instance, on Linux, to get colored ls ...
0
votes
0answers
108 views

Raspberry Pi, how to execute program as a SU and stop loop in bootup

I have a script python.py and wish to execute the program after the boot-up sequence, one problem is it needs SU access in order to have the write function inside the program. Without the SU, the ...
1
vote
0answers
45 views

retrieve the status of a backgrounded lftp session

I have an ongoing ftp upload with lftp which is backgrounded and i am wondering if there is a method to retrieve the status of the upload in a scripted way. What i've figured out so far is a way to ...
0
votes
2answers
359 views

GNOME3 keyboard shortcuts doesn't run my script

I have a home made script that takes a screenshot and uploads it to puush, and I have put the script in /usr/bin. If I open a terminal and write the name of the script it runs perfectly. I use Debian ...
1
vote
1answer
324 views

How do I create a one time use startup script on Linux - Centos 6.x

I want to set a script that will only run one time on a Centos 6.x box and then never run again, since it's going to set some system options based on hardware and then it's all set.
1
vote
1answer
90 views

Having trouble with what should be a simple bash script

I'm having a problem with one segment of the following script. Each echo->grep->was written in to help me figure out where the script was failing to perform as I expect it to. It is designed to be ...
0
votes
1answer
81 views

Ubuntu - Disk Duplication - Automation

I know very little when it comes to linux but I'm looking to construct a cheap disk duplicator out of an old server that we have. The server is currently running Ubuntu 12.04LTS and has 8 hot ...
0
votes
1answer
163 views

Changing the sequence numbers of files in Linux

Is it possible to write a script to rename a series of file as below: sol-temp_0010.png to sol-temp_1.png sol-temp_0015.png to sol-temp_2.png sol-temp_0020.png to sol-temp_3.png etc.?
0
votes
1answer
342 views

sudo: source: command not found when executing tcl as sudo

I have a test.tcl (has all permissions) which contains the following- #!/usr/bin/tclsh puts "hello, world" This is how I'm executing my tcl script- sudo source /opt/test.tcl I got the ...
0
votes
1answer
197 views

Cron fails the script command

I am trying to capture a picture with my webcam and I need to log the output to check for errors, but cron is failing at this. I am able to do this from terminal, but cron running it doesn't work. ...
3
votes
1answer
572 views

Is there a script to add port forwarding rule in home router?

TL;DR: I am looking for a script or a cron job, which will periodically run on a linux host (fedora on raspberry pi) which will check if a port forwarding rule still exists in the router and add it if ...
0
votes
1answer
59 views

What would an update mechanism look like in bash

I have to update a script compilation from time to time but I haven't any idea how to start a version check script in bash. I've got a version file with 3 vars: version=0, subversion=0 and ...