In shell scripting, a shell such as bash runs a file containing a list of commands (a script). The script is effectively a program and the shell is its interpreter.

learn more… | top users | synonyms

18
votes
3answers
47k views

How do I run 'sudo' command inside a script?

To do a patch manually I must type this command sudo ./playback_delete_data_patch.sh 09_delete_old_data_p.sql There is a space just before the 09: sudo ./playback_delete_data_patch.sh [space] ...
1
vote
1answer
21 views

can not run the command from shell script but it's fine when typing directly into terminal

I am trying to run a shell script with the bellow content ns script.tcl sleep 100 the command ns works fine when typing in terminal but says: ns : not found when runing from the shell script.
12
votes
2answers
713 views

Is there an easy way to log all activity that a shell script does?

Is there an easy way to log all activity that occurs from a shell script to a file? I have a script. It outputs things like echo "instructions", as well as other program output. I know the commands: ...
6
votes
3answers
164 views

Getting internet browsing history from shell

is it possible to use the shell or generate a shell script to find out the browsing history from the browsers installed on the system? thank you
1
vote
1answer
141 views

How to run streamus app from terminal

I use Streamus to stream music from you tube. I want to know whether streamus can be started from terminal itself. I have asked this question in main software site and the author recommended to use ...
0
votes
1answer
22 views

exit shell script when a process check is failed

i need to exit from shell script when TESTEXCHANGE process is not running on a host.How can i handle this: I have a script processcheck which checks if the process is running. I call that to the ...
-1
votes
1answer
18 views

how do i open a different host session from shell script and start a process on it

I want to open a new session and run a process on it as part of the shell script.How can that be acheived. I need open a session with test@Testhost and run a process ./testprocess on that separate ...
0
votes
4answers
53 views

Using grep in /etc/passwd to fetch list of users and system users, discriminating both

I want my grep to print a user list from /etc/passwd, and I've studied /etc/login.defs' minmax values for the ones I want my grep to fetch: # Min/max values for automatic uid selection in useradd # ...
12
votes
3answers
3k views

How to do: underline, bold, italic, strikethrough, color, background, and size in Gnome Terminal?

How to do: underline, bold, italic, strikethrough, and color in Gnome Terminal? Bold Italic u̲n̲d̲e̲r̲l̲i̲n̲e̲ s̶t̶r̶i̶k̶e̶ ̶i̶t̶ ̶l̶i̶k̶̶e̶ ̶i̶t̶s̶ ̶h̶o̶t Color background font < (its mono ...
1
vote
3answers
228 views

Shell script If syntax error

if ($(ipcs|grep test|wc -l)=630); then echo "Shared Memory check passed" fi I get below error: ./Test1: line 25: 636=630: command not found
0
votes
2answers
45 views

execute shell script without entering password

I want to execute a script that requires root privileges without entering a password. There are similar questions/answers but non seems to work for me. I placed my script in /home/kf/bin (I added the ...
0
votes
1answer
35 views

Unable to hide unity launcher automatically on startup Ubuntu 14.04 machine and set reveal sensitivity to low of launcher form shell script

As per my project requirement, I need to hide unity launcher(if present) automatically on startup Ubuntu 14.04 machine. If I run the script dconf write ...
0
votes
0answers
13 views

Zenity and Yad messages/warnings in Lubuntu

How to clean those messages from the terminal? ** (yad:2499): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not ...
0
votes
1answer
48 views

shell script executing on remote host

I want to run testcmd.sh on remote host (Testhost) using the following command: ssh test@Testhost 'bash -s' < /test/testcmd But I get the below error : !!!!!Running MASTERCMD!!!!! bash: line ...
0
votes
1answer
32 views

Replace /1/ with newline charecter [closed]

I have a record like: "evSchema"\1\"UAT" "evSN"\1\"uadb" "evDirsep"\1\"/" "evRootPath"\1\"/work_area/APP_UAT/" "evSchema"\1\"RMS13" "evUser"\1\"STAGE" stored in a variable $record. I want to ...
0
votes
1answer
42 views

Running shell script using PHP over http

OS - Ubuntu 14.04 Well I am working on deployment using GIT webhooks for it. I havea added the deployment keys to git repo and now I want to trigger the git pull origin master command when a push ...
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/ ...
0
votes
1answer
26 views

How can I show a variable in a dialog box

$value = V dialog --title "Message" --msgbox '(here the data stored in a variable value must be displayed' 10 20
0
votes
1answer
32 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 ...
-3
votes
1answer
22 views

script to check if the file is sorted based on field 3

I want to check if the file is sorted.I have below file.I want to point out the records which are out of the order. 091000010004029881 1 08/03/2015 13:07:57.132 LS1508030031D8M00000 ...
4
votes
3answers
66 views

sort a file based on the field 3 of the file contents

This is the contents of file 090100010000481074 1 08/03/2015 09:35:15.934 LA150803000AJSX00000 LA150803000AJSX CRBP Buy ELF 100 1980000 119 3 2 1890000 ...
0
votes
1answer
72 views

How to compare float variables in awk?

awk -F, 'NR==FNR{c[$29]=$29;next} NF{print $29 ((c[$29]==$29)?" ":",mismatch")}' $file1 $file2 The value of 29th field, i.e., $29 in file1 was 832.9 and that of file2 was 832.9000. If I compare them ...
4
votes
3answers
246 views

How to use double substitution in awk?

To print the fields at 29th column in two files I used paste <(awk -F, '{print $29}' PreRefFile.csv) <(awk -F, '{print $29}' Txlog.csv) This worked fine. To print all the fields starting from ...
0
votes
0answers
34 views

QT gui application not starting automatically on startup in ubuntu 14.04

I have two Qt applications, one is non gui called "App1" and another one is gui called "App2". As per my need I need to start "App1" on startup of Ubuntu 14.04 machine. This "App1" runs a sh file ...
0
votes
2answers
33 views

shell script to check if a process is up

I want to check if a proces is up: [nyxqa@qckmaccg102 scripts]$ ps -fu nyxqa UID PID PPID C STIME TTY TIME CMD nyxqa 19620 1 0 08:42 ? 00:00:00 ./ArcaDirect ITD ...
-4
votes
0answers
23 views

Shell script to read specific files in a folder and the change the filenames

I need a shell script that loops over all the files in a folder and does some actions on the files. For example. /data/LST/ABC folder has below: LSTFile1 LSTFile2 LSTFile3 LSTFile4 LSTFile5 ...
3
votes
2answers
79 views

Difference between “./” and “. ” for running a script/application? [duplicate]

I always ran scripts using ./ For example ./script.sh I recently learned that you can also type . script.sh Is there any difference? The second is much easier for me since my keyboard ...
-1
votes
1answer
18 views

sql query fro oracle DB using shell script [closed]

$ cat DBUpdate #!/bin/bash sqlplus -s bb_split/pwd@q:1521 <<< "DELETE OUT_QUEUE01 WHERE TDATE=TO_DATE('$1', 'YYYYMMDD')" i get below error: ./DBUpdate: line 5: sqlplus: command not found ...
3
votes
3answers
276 views

Rotate images from terminal

I have a directory with a lots of image but they are in wrong orientation. I want to rotate the images to correct orientation (mostly ±90o). Using image (shotwell photo) viewer I can rotate ...
0
votes
0answers
20 views

identify a process with command and kill it [duplicate]

I want to kill a process which has /app/test/bin in the command name using shell script In below example:I want to kill the last one. nyxqa 25939 0.0 0.0 121416 2792 ? S Aug10 0:00 ...
-1
votes
0answers
36 views

bash: ${debian_chroot!-}: bad substitution

So I'm learning how to shell script and i got this error. Every thing I've read on the other posts makes it seem like a directory file path like most terminal commands have stashed away. My version of ...
3
votes
2answers
187 views

Script to set IP address connected to an interface to a shell variable

I want to write a script to set the IP address of the device connected to an interface like "eth0" to a variable. I can get the IP address by this command: arp -i eth0 -a The output of above ...
0
votes
1answer
46 views

Lengthen Variables

I print data to a form in a console and use tput cup the print it on the same position. This way I can create a sort of form with a small discription of each value. but if you run var=12 tput cup 2 ...
0
votes
0answers
12 views

ERROR with gem for a ruby tool?

I am trying to install a tool script called bio-polyploid-tools and I am getting this error after command sudo gem install bio-polyploid-tools sammanmahmoud@samman[bioruby-polyploid-tools-master] ...
4
votes
3answers
2k views

Syntax error near unexpected token `('

When I use below code in Ubuntu terminal, it works fine: rm !(*.sh) -rf But if I place the same line code in a shell script (clean.sh) and run the shell script from terminal, it throws an error: ...
0
votes
0answers
70 views

How to press ENTER in Nano on Ubuntu-touch via abd?

When I'm connected to Ubuntu Touch (bq Aquaris E4.5 Ubuntu-Edition phone) via adb shell and I'm editing a shell script with Nano. How can I press ENTER to save changes? Nano does not accept the ...
0
votes
1answer
76 views

Removing everything from my Ubuntu install, even GUI..?

I've got an interesting question today. I want to remove EVERYTHING from my Ubuntu install (or remove the OS and just add an empty kernel), but in either case I don't know exactly how. I want a ...
2
votes
1answer
45 views

parse webpage upto n levels using wget

I am trying to extract URLS from a webpage up to user defined n levels using wget. I tried this wget -r -l$2 --reject=gif -O out.html www.google.com | sed -n 's/.*href="\([^"]*\).*/\1/p'` " It is ...
0
votes
1answer
43 views

not getting output in terminal while running the php script

test3cron.php <?php @ob_start(); session_start(); $callbackUrl = "http://mgstore/test3cron.php"; $temporaryCredentialsRequestUrl = "http://mgstore/oauth/initiate?oauth_callback=" . ...
0
votes
1answer
27 views

source a config value with variables [closed]

Example: I have a config file where I want below to have date in the value cat conf.ini path=/var/opt/[date]/yellow I want my script foo to read path and substitute with date passed as argument ...
2
votes
3answers
81 views

shell sript to read source file and use the key in the script

#!/bin/bash source /data/output/QAScripts/conf.ini var=$($1path) echo $var conf.ini is the config file which has LSTpath=/data/bb/loader I get below below error. Where am I going wrong. ./file ...
-1
votes
4answers
107 views

=0 command not found bash

grep "::=BEGIN" -q < /home/erawson/bin/HP/adaptec.mib CHK= echo $? if ($CHK = "0") ; then echo "failed" else exit fi error is: /home/erawson/bin/try1: line 10: =: command not found
1
vote
1answer
56 views

bash - can shellcode be made from a bash script?

I was thinking it can't, since there's not really a binary for bash scripts, but having to write a C program every time you need to generate shell code for a single command is just a pain.
0
votes
2answers
46 views

Concatenate multiple files without header

I have several directories ("amazon", "niger",...), in which I have several subdirectories ("gfdl", "hadgem",...), in which I also have several sub-directories ("rcp8p5", "rcp4p5",...). In this last ...
0
votes
2answers
49 views

End of file syntax error shell scripting [closed]

#!/bin/bash source conf.ini inotifywait -m -e create /$1path | while read file; do if ($(echo $word | head -c 1)"=$1 then echo $file cd $1inputpath ls -l |grep $file* zcat $file* > ...
0
votes
2answers
37 views

Cannot open zip created with shell script [duplicate]

I try to make a backup script, but when i create a zip with the script, and use cd myzip it sais that it dosnt exitst even when i can see it on the server with FileZilla. This is my script: ...
0
votes
0answers
17 views

scan folders for file parallely with shell script [duplicate]

I have multiple folders which i have to scan them real time asynchronously with shell script.Can some one help me. Its like I have folder1/fodler2/folder3 ....,i need to scan these folder for files ...
1
vote
2answers
34 views

How do i run different scripts parallely using shell

I have script1,script2,script3 I have to execute all the three at same time using one shell script.Not one after the other.How do I do that?
2
votes
2answers
26 views