Script is series of instructions written in plain text file. The script interpreter (i.e. shell, Python, Ruby, etc.) can read this file and act on the instructions as if they were typed at the command prompt. The interpreter also provides a variety of useful programming features to make your scripts ...

learn more… | top users | synonyms (1)

0
votes
0answers
6 views

Trying to Get Total CPU Usage in Bash

I'm trying to get the CPU's total load with this: IDLE=$(mpstat | grep "all" | cut -c 92-) CPULD=$(expr 100 - $IDLE) echo $CPULD but it always returns "expr: non-integer argument" on ...
0
votes
1answer
9 views

View the live log in linux

I want to See the Live log from the Log file which is being used within the Script. So basically i have one Script running and within the Script i am also updating the logs about the Task which is ...
1
vote
1answer
11 views

Minimal server configuration only to send logs via mail from scripts on Ubuntu

I have a Ubuntu 12.04 configured as Gateway and OpenVpn server. I have made a script that changes the VPN destination based on destination reach-ability. Now I want a simple command included on the ...
3
votes
1answer
24 views

how to make a BASH script to find all php.ini files in dir tree and append text to them

My hosting company advertises a php max upload size that can go up to 60M but, It defaults to 2M and I am not able to make changes to the htaccess file. I can override the default by changing the ...
0
votes
0answers
17 views

Setting IP routes using script

My Setup In this setup, the server can see the routers but not see each other causing the clients to not be visible to each other as well. The VPN is set up using PPTP and the routers have DD-WRT ...
2
votes
1answer
16 views

udev script doesn't run in the background

I'm having trouble getting a script run by udev to run in the background on usb insert. My udev rule seems to work, since it definitely calls the script, but no matter what I do, I can't get bash ...
0
votes
1answer
30 views

File not running on startup

I have a file that starts another script in a folder. When I run this file using command sh /etc/init.d/scriptname it runs the other script fine. The file has the 001 permission that I assumed it ...
0
votes
2answers
40 views

How to backup and reinsert .bashrc-like files with post-install script?

I have my proudly written .bashrc and .bash-aliases files. Sometimes, I edit them. More often, I reinstall the whole system. What is the best and simplest way to preserve content of files (for ...
1
vote
0answers
23 views

Simple way to delete a file and all its links (simultaneously)

I found a lot of questions on how to delete symlinks only, or delete symlinks based on their contents, but no one has asked how to do what I want to do. Take the following example file-l -> ...
0
votes
0answers
3 views

Installation error with Java (JDK 7) [duplicate]

I was trying to install JDK7, got everything done, download completed, but then I got faced with this error: Download done. Removing outdated cached downloads... sha256sum mismatch ...
0
votes
2answers
18 views

How to turn numlock on from command line

So it looks like numlockx is the standard way to have numlock automatically enabled. In my case I have my own scripts that run at startup anyway, and it just feels cumbersome to install an entire ...
0
votes
1answer
13 views

Move folders modified a day prior 6.30 p.m

I need to move folders which are modified a day prior 6.30 p.m. For example. The folders which are modified in Day 1 before 6.30 p.m should be moved to another folder. Please help me. Regards, Syed
0
votes
1answer
21 views

keep track of multiple terminals from shell script

I am writing a quick start shell script to automatically set up my development environment for a current project. However, none of the commands in the shell script can be executed after my server ...
-1
votes
0answers
25 views

Start bash script from another script

I have two scripts /etc/init.d/script_1 and /opt/script_2. I need to call script_2 from script_1. In script_1 i write: /opt/script_2 And it works. But there is small option with script_2 - it must ...
0
votes
1answer
37 views

Bash Script for Running Command in Root in ADB Shell

I am trying to dump the partitions of Android devices with netcat. I have created 3 bash scripts for supporting the process. I have trouble on the second which to dumpt the specific partition ...
7
votes
2answers
156 views

How to highlight current screen (or window)?

I'm using two screen setup at work and while it usually helps more than it hurts, I have some issues with it. One of them is problem with trailing focus - sometimes I make mistake of typing on wrong ...
0
votes
1answer
36 views

read file names from files for command line

I want to run a program requiring comma-separated arrays of files as follows: program -input1 A.txt,B.txt,C.txt -input2 D.txt,E.txt,F.txt -out out.txt My bash attempt: I'm running command from a ...
0
votes
0answers
18 views

What are the initialization scripts that are executed when logging into Ubuntu? [duplicate]

Apart from ~/.profile, what other scripts are sourced as one logs in to Ubuntu, and in which order? I would like to know specifically about the ones that set the system environment variables, ...
42
votes
14answers
127k views

How can I create a select menu in a shell script?

I'm creating a simple bash script and I want to create a select menu in it, like this: ./script echo "Choose your option:" 1) Option 1 2) Option 2 3) Option 3 4) Quit And according to ...
13
votes
6answers
35k views

How to round decimals using bc in bash?

A quick example of what I want using bash scripting: #!/bin/bash echo "Insert the price you want to calculate:" read float echo "This is the price without taxes:" echo "scale=2; $float/1.18" |bc -l ...
-1
votes
0answers
15 views

Modify Value Tags in xml file by command shell script [closed]

mapred.tasktracker.map.tasks.maximum 2 The maximum number of map tasks that will be run simultaneously by a task tracker. mapred.tasktracker.reduce.tasks.maximum 2 The maximum ...
6
votes
3answers
4k views

How to completely restart script from inside the script itself

I'm setting up a shell script with menues and sub menues, options, etc. But on each menu/submenu/etc, i need a "Go back to main menu" choice. I've already got the menu set up and it works fine, but i ...
3
votes
1answer
51 views

Replacing string in a file

I wrote the following command: rpl -x'.txt' '0 ' '-1 ' /home/administrator/temp/myText.txt However I get an error message: Usage: rpl [options] old_string new_string target_file(s) rpl: error: no ...
1
vote
2answers
4k views

How to add the logs to a crontab with time stamp

In crontab, I scheduled a daily backup script. Now when the cron executes the script the status are logged to a log file as shown below. 0 0 * * * /home/backup.sh > ...
0
votes
1answer
26 views

How to *Fully* Automate an Ubuntu Install?

I currently am in a pickle where I have to install Ubuntu on up to hundreds of machines and I cannot use my right hand right now due to an injury. I need a simple way to completely automate the ...
2
votes
2answers
120 views

How can I copy the path to the currently opened file in gedit to the clipboard?

I am trying to write a custom command in Gedit which copies the currently open and active document's path(both upto parent dir & upto file) to clipboard, as I couldn't find any gedit-plugins or ...
2
votes
1answer
43 views

rsync multiple IP's using bash script?

I am trying to use rsync to synchronise remote files with local server. It works great but I want to do it on multiple remote servers to sync with on daily basis. sshpass -p "xyz" rsync -avz ...
0
votes
1answer
56 views

nfdump schedule with cron

Hi I tried to generate nfdump file with crontab, but whatever the reason it dosent work my script #!/bin/bash nfdump -mR /home/user/test -zw /data/fnf1.dump this script itself works and all other ...
0
votes
1answer
60 views

Copy standard output to file

Script1 uses echo (and other commands) to standard output. Script1 also runs other scripts, which also use echo (and other commands) to standard output. Script1 is called by a scheduler that stores ...
0
votes
0answers
57 views

Execute jar file when user mount a loop block device linux

I successfully created and mounted a loop block device using these commands. dd if=/dev/zero of=my_fs bs=1024 count=30720 losetup /dev/loop0 my_fs mount -t ext3 /dev/loop0 /mnt/fs_mount_location/ ...
0
votes
1answer
24 views

renaming files script error

I wrote code to change the name of bulk of file it should replace spaces with underscores and lowercase all the file name .. this is the code for file in *; do mv "$file" `echo $file | sed -e 's/ ...
2
votes
1answer
791 views

Need software to track login and logoff timings

I am in a need of software which can track login and logoff timings on user basis. If possible, software should be cross platform. If you know such software, please share.
0
votes
0answers
22 views

rc.local commands execution

The general idea is: I have developed a script.sh (in java) that take a value from a .txt where a python code is saving data from a sensor, (with a specific range of time). This value is up to the ...
1
vote
1answer
44 views

How do I run this script with sudo from the command-line? [duplicate]

I have the following script in my user's bin directory; let's pretend the filename is 'myScript': #!/bin/bash python3 /myPath/myProgram.py "$@" From the commandline, if I type myScript, it ...
1
vote
2answers
4k views

Cannot run bash script from crontab when it works from command line bash

I have a strange problem of being to able to run a bash script from commandline but not from the crontab entry for root. I am running Ubuntu 12.04. * * * * 1-5 root ...
1
vote
2answers
39 views

Cronjob bashscript help

I've looked through a bunch of cronjob troubleshooting guides, but I can't seem to find what I'm doing wrong. This script runs just fine if I run it manually. Running it from crontab just isn't ...
0
votes
1answer
33 views

How to change file text content only with Shell Script commands?

In a file, there is: sd5_crypt UUID=1337 none luks,discard I'd like to change it to: sd5_crypt UUID=1337 /dev/disk/by-label/MON_LABEL_ICI:/keyfile luks,keyscript=/lib/cryptsetup/scripts/passdev ...
0
votes
1answer
37 views

How to write a shell script to start gedit and not showing the terminal window? [closed]

How to write a shell script to start gedit and not showing the terminal window? That means: when I click the file runme.sh, only gedit window shows, no terminal window shows. Just like I click the ...
2
votes
2answers
252 views

Translating from Red-Hat to Ubuntu

I am starting in linux because I need it for my reseach. Since I have little time and no local expert support, this is a need based self-learning experience. I have to install a tool and I got this ...
1
vote
1answer
44 views

Schedule shell script to display output in terminal

I have added a shell backup script to crontab, and it seems to run every night, but I currently need to check the target to see that it's worked. What would be much more helpful would be for the task ...
0
votes
1answer
52 views

Remove Audio Streams of videos - recursively without converting audio or video with FFMPEG

Lets say for example you have a season of a TV show, the best encode you can find, but it has multiple audio streams, that you don't need. You don't want to re-encode and loose video/audio quality and ...
2
votes
1answer
39 views

Automatic Account lock/logoff script

I have 2 scripts created. The first one called "lock_logoff" and it does just that. It locks the account in the script and then logs them off. The second script unlocks the account. I got tire of ...
1
vote
0answers
20 views

Testing post-install scripts

I love to experiment with my Ubuntu GNOME 14.04, so there are many mistakes to be made and things to learn. Often I want a clean install, so I made post-install script. Question is: what is the best ...
5
votes
1answer
106 views

Bash script doesn't run from nautilus, but does run from terminal

Before I add more detail to my question, I have to say something very important: Yes my script has "Allow executing file as program" turned on The question itself: For programming reasons (shared ...
0
votes
3answers
45 views

I need to change Gamma to .8 on startup

I added the command sudo xgamma -gamma .8 to rc.local in order to change the gamma on startup but its not changing it: #!/bin/sh -e # # rc.local # # This script is executed at the end of each ...
-6
votes
1answer
26 views

script to search all numeric no's greater than or equal to 13 digit

I have a requirement where i need to find the credit card no's in a set of files(*.txt, *.csv or any extension). Credit card no's are numeric and has a minimum 13 numeric digits or more. So basically ...
0
votes
0answers
16 views

Need help writing a script to re-pair with a Bluetooth Mouse

I'm having a bit of trouble with my htpc setup, the bluetooth keyboard connects automatically and works, but the mouse doesn't and has to be re-paired for it to work. It also keeps disconnecting. I'm ...
2
votes
2answers
196 views

Is typescript for `script` command the same as TypeScript maintained by Microsoft? How to print using `ldr`?

Is typescript for script command the same as TypeScript maintained by Microsoft? How to print using ldr ? What exactly is typescript in relation to Linux/Ubuntu ? Searching Google, I find that ...
0
votes
2answers
162 views

Using sed to remove all lines containing special characters , numbers, and spaces

So I'm fairly new to using shell--bash specifically--and I'm in the process of writing a script which will translate files containing DNA sequences into a more useful format. Unfortunately, many of ...
0
votes
1answer
45 views

failed to execute '/bin/eject'

Recently we failed in searching campaign for a Modem Manager for my ZTE USB modem in Ubuntu 14.04 and since then, I am getting, in my Ubuntu starting messages (probably boot scripts), a bunch of ...