0
votes
1answer
46 views

return value from awk

This is mybashfile.sh file . . . awk -f myawkfile.awk mytracefile.tr . . . Now I want to return one parameter from myawkfile.awk to the current mybashfile.sh. Is there any way to return a value ...
12
votes
3answers
821 views

Should I save my scripts with the .sh extension?

I have some functional scripts and I want to copy to /usr/bin I want to use them as normal terminal commands. It is a good practice to use them with the .sh extension or I can save them without ...
0
votes
1answer
24 views

Can't install HoNClient-3.4.3.sh

I'm desktop user. My OS running 32-bit Ubuntu 14.04LTS. The problem I've run into is this: When I try to run the client in the terminal, using the command: sudo sh HoNClient-3.4.3.sh it gives me ...
0
votes
1answer
32 views

Unigine Heaven run directly from terminal?

I think a lot of you would have benchmarked your Linux system using Unigine Heaven Benchmark 4.0. I know to run the it you can simply go to the Unigine Heaven folder and run the shell script file ...
1
vote
1answer
61 views

Run the script file after 5 or 10 min after restarting the system

I have created a ruby script file that checks the connection present or not. For example checking port 22 is opened or not. Firstly I tried with cron job as follows @reboot find ...
23
votes
3answers
1k views

Where should I put my script so that I can run it by a direct command?

Where can (should) I put my (bash) script so that it can be used (forever) by terminal or by a direct command: Alt+F2? I know there is /usr/bin and /sbin & /bindirectories but when should I use ...
0
votes
1answer
30 views

Shell script backup routers

Below is a script I've wrote to backup my routers and adsl modem, Any ideas to compact this script in less lines? Each router have a different kind of structure as you can see. #!/bin/sh ...
1
vote
1answer
125 views

Bash script doesn't execute command from PATH

I have this simple script: #!/bin/bash echo ${HADOOP_HOME} $(hadoop fs -ls) The output is: /opt/hadoop-0.20.2-cdh3u2 ./hello.sh: line 3: Found: command not found So bash definitely sees ...
4
votes
3answers
98 views

How to check the number of fields given to the `read` command?

I have a quick question relating to $# in the shell scripts. So, I can use $# at the command line to check the number of a shell script arguments given by the user. Example: # ./shellScript varONE ...
3
votes
1answer
201 views

pkill not killing

I have a Script named PirateRadio.py That I am writing a script for. I need to kill and reload the script. Possibly with the same PID. I thought SIGHUP was a sure thing. when i run #pkill -1 ...
3
votes
1answer
69 views

How can “git gui” open repository from parent directory?

I start Git GUI tool using command git gui or git citool. I wanted to add another entry to right click script menu (already have dozens of commands) and created a script like this: #!/bin/sh git ...
4
votes
2answers
237 views

How do I iterate the arguments in a bash script?

Is there any method to iterate the passed arguments in a bash script? This answer from my question shows me how to use each argument, but I want to iterate them because the number of arguments is ...
3
votes
1answer
398 views

How to check in a bash script if passed argument is file or directory?

I have to write a simple bash script in Ubuntu which would allow me to pass it some arguments and I want to check if these arguments which can contain spaces are files or directories. How can I do ...
1
vote
1answer
75 views

How to see if there are any qbittorent torrents from shell script?

I run a script on startup that opens a browser, irc, and qbittorrent. It looks similar to this: chromium-browser & qbittorrent & xchat & guake & Is there any way I can detect if ...
0
votes
0answers
19 views

Startup script for pxeboot

I am working on pxeboot. Now i want to do startup script in pxeboot server and whenever client started the startup script will run on the client machine. How to do that. ?
3
votes
3answers
201 views

How to concate strings in a bash script to use in SQL-Statement? [closed]

I would like to do the following in a bash script: read some filenames out of an file with filenames set a variable input path concat 1. and 2. use 3. in sql-statement Here my code: ...
0
votes
1answer
468 views

Creating and executing shell scripts to run XAMPP on double click [duplicate]

Basic Specs - Ubuntu 13.10, Gnome 3 (session fallback), Ambiance theme, Faenza icons. I recently installed XAMPP, now everytime i want to use the program i have to run the sudo /opt/lampp/lampp start ...
2
votes
1answer
219 views

Yad list columns

I need some help with Yad. This is my code: contact=$(while read line do firstname=$(echo $line | awk 'BEGIN { FS="|" } { print $2 }') lastname=$(echo ...
0
votes
0answers
36 views

Need a shell script to loop launching a connection to a thin client, waiting, logging off, then connecting to a windows 7vm

I'm very new to Ubuntu and I need to have a shell script to do what the title says. I used: xfreerdp -u [uname] -p [password] -o --plugin drdynvc --data rdpeusb -g 1280x1024 -- [vm's ip] to make ...
0
votes
2answers
271 views

how do I use upstart, instead of cron, to start a single instance of a job which should always respawn?

How do I script the following bitcoin/dogecoin/etc cpuminer command: /home/digger/cpuminer/minerd -o stratum+tcp://doge.pool.webxass.de:3333 -O <user>.<worker>:<worker_password> ...
0
votes
2answers
771 views

cron error: bad username

I've basically re-written the terminal output instead of appending a series of edits to this question: root@doge:/etc/cron.d# root@doge:/etc/cron.d# tail /var/log/syslog Dec 21 11:35:01 doge ...
1
vote
1answer
72 views

Running a script at shutdown

I've read the answers to this and similar questions already, but so far none had worked for me. On my Ubuntu 11.10 (oneiric) system, all the files in /etc/rc0.d/ and /etc/rc0.d/ are links. I put ...
0
votes
1answer
158 views

sending email if disk space exceeds

I have a script to calculate available disk space and alert by email if the limit exceeds a given value defined by me. Here is the script: df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 ...
0
votes
2answers
46 views

when to use -f or -a tag in if loop

I'm confused between two tages that can be used in if statement in bash scripting. One is -f and other is -a. Their description states as follows: [ -f FILE ] True if FILE exists and is a regular ...
5
votes
3answers
332 views

Convey some message to all users

Is it possible to write a shell script that enables any user (may not be root) to set a message(e.g. "Download on progress do not turn off" etc.) which will be conveyed like pop-up message (zenity or ...
0
votes
0answers
16 views

How to run a script automatically if there is any specific hardware is detected [duplicate]

I want to run a script automatically when a headset was inserted on its corresponding jack and a USB modem was inserted on its corresponding ports. Any help will be appreciated!
0
votes
1answer
462 views

Select (loop) or command not working in shell-script [duplicate]

I've been tinkering with Linux and Unix for years but still a novice in my mind and recently find myself trying to be more pro with it as I work in IT. So with that notion I'm studying shell ...
0
votes
1answer
49 views

Unmount script running on unmounted device

How can I unmount a USB drive using a script located on that drive? The device appears busy when the script is running,
0
votes
1answer
139 views

Cant create a file and write to it from a .sh script

I am trying to create a file and write to it using a .sh script but is not working(Nothing is being created, and I don't see any error). This is how that part of my script looks like: ...
1
vote
1answer
79 views

I can't rename a file using the terminal if it came from a parameter

I am automating some deployment task with an .sh script but at some point I need to rename a file but it is not working. The file change can be different but the postfix is the same. Let's have a look ...
1
vote
1answer
423 views

Shell Script Unable to send execution time via email

I wrote a shell script which calculates the execution time of itself but the problem I'm facing is its not able to send the time difference via email. Please Help. Here is the Script #!/bin/bash ...
0
votes
3answers
219 views

How to insert characters after every line in a file?

I want to create a script that insert 20 characters following each line in a text file. Suppose the file contains the following lines: text.... text.... text... I want to obtain: text.... ...
2
votes
1answer
2k views

Malware and Backdoor detection Shell Script

I'm trying to build a shell script which can automatically detect malware, backdoors and rootkits and I'm trying to research for it. I found some of the things like find . -name “*.js” | xargs grep ...
0
votes
1answer
72 views

Unrar: Resulting files vanishing

Ok, so I have a directory which contains a whole load of folders containing RAR files, which I'd like to use a script to recursively unrar. The script I have seems to work (extracting the resulting ...
0
votes
3answers
129 views

Error running a script: ?#!/bin/csh: No such file or directory

I am trying to run the following script which will start a simulation run with a climate simulation program: #!/bin/csh # run-script generated by Most Tue Jul 23 13:10:46 2013 set EXP=MOST # Name ...
0
votes
1answer
286 views

sendmail gives empty recipients in email

Im using a script that takes backup and sends status email using sendmail but the emails its sending comes with the to tag empty here is an image of it Here is the part of the script #Email ...
0
votes
1answer
946 views

Script to email files content

I have created a shell script that takes backups everyday and emails its execution as successfull or unsuccessfull. Now I want that it send the contents of log file it creates with the mail as well. I ...
1
vote
2answers
747 views

script to compress multiple files

I have a script that generates backup and finds files older than 30 days and compresses them. Now the problem I'm facing is if the files are more than one than how can I edit the script so that it ...
1
vote
2answers
250 views

Shell Script to block Ip addresses

Is it possible to write a shell script that checks connections in an apache server and blocks suspicious ip addresses with large number of connections automatically and fires a mail for it to the ...
2
votes
3answers
2k views

How to discover the IP addresses within a network with a bash script?

Is it possible to determine the IP addresses of systems within a network using a bash script? And how?
1
vote
2answers
3k views

Problem on running shell script (how to NOT make it run from gedit) - Ubuntu 12.04

I want to run shell script or at least run it from terminal. I tried going to home folder/edit/preferences/behaviour and set executable text files to 'ask each time' but it doesn't even give the ...
11
votes
6answers
21k views

Not able to execute a .sh file: /bin/bash^M: bad interpreter

I wanted to execute a shell script: -rwxr-x--x 1 root root 17234 Jun 6 18:31 create_mgw_3shelf_6xIPNI1P.sh I tried to do a standard procedure, but I am got this error: ...
0
votes
1answer
845 views

Run script on remote machine via telnet (not SSH)

I need to somehow run a script which resides on a remote machine running Ubuntu. SSH or any other connection type that requires complex encryption is not possible. The client that will connect to the ...
0
votes
1answer
372 views

Macxchange Script to Change MAC and Hostname in ubuntu 12.04

I'm trying to adapt a script in backtrack to work with ubuntu. I keep getting an error on line 14 which is the "if [ $? == 0 ]; then" line the script was found on ...
10
votes
3answers
9k views

How to run a script during boot as root

I had a script that automatically enables my wifi without using networkmanager, but I don't know how to run the script as root while the system is booting. How do I make the script run automatically ...
0
votes
2answers
312 views

my user ~/bin folder is not working

I'm running 12.04 I have two files /usr/bin/uim-tomoe-gtk ~/bin/uim-tomoe-gtk the first is the tomoe kanji program the second is a script that runs kanjipad instead #!/bin/bash exec kanjipad ...
1
vote
2answers
178 views

Installing packages remotely via bash script in ubuntu

I am trying to install firefox packages to all my linux hosts remotely using a bash script. But when ever i execute the script i get the following error. How do i enable DISPLAY in bash script? ...
3
votes
1answer
156 views

Help Debugging Backup Script

Every 3 hours the script will run and backup a folder "SOURCE" and it will save it along with the other backups of the current day in the folder "month-day-year" e.g. "03-24-13". When a new day comes, ...
1
vote
2answers
997 views

How to run shell script commands manually

I'm running Ubuntu on my Samsung ARM Chromebook in chroot via crouton. I'm trying to run Cisco AnyConnect VPN in Ubuntu and ran into an issue. It installs but the daemon won't start. I found a ...
0
votes
0answers
42 views

Can I store a password in a bash script? [duplicate]

Is there some way to store (for example hashed etc.) secured password in a script that will be used during connection to server? Storing password and username as clear text in code for me is quite ...