Troubles with shell script versus terminal on Pi [closed] - windows

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am trying to share a folder on a windows computer with the raspberry pi.
when I use these commands in terminal:
sudo mkdir -p /mnt/foldername
sudo mount -t cifs //IPADDRESS/folderIwanttoaccess/ -o username=usrname,password=passwrd /mnt/foldername
This works fine and I am able to save files on the raspberry pi to the windows shared folder.
but when I try this in a shell script I am able to see the folder as shared but with "^m" at the end.
for example: Foldername^M
Why does this happen and is there a way around to stop the "^m"?
Thanks in advance

According to this, you can sort your problem using sed, merely by using the following incantation: s/^M$//. Hope that helped!

Related

Is it acceptable to use Git BASH for non-git tasks in Windows 10? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I've been using Git-BASH terminal for non-git tasks. I prefer to use and am more comfortable using a BASH terminal over the Windows PS or Command Prompt. Basically, I started looking into having a BASH terminal on Windows, when I realized I already have one.
Is there any technical/integrity/security risk to doing this?
There is no "GitHub bash", only the git-bash packaged with Git for Windows.
It is the only alternative to WSL (the Windows Subsystem for Linux).
I usually use Git for Windows with a simplified PATH, which means I have 200+ Linux command right from any shell session, even a simple CMD one.

Shell script for installation [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I need a shell script file for Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support (LEMP) On Ubuntu 12.10. Can anyone direct me to create a shell script file to install these tools. Am new in creating shell script.
Your response should be appreciable!!!
Shell script is, basically, a file with commands you'd execute anyway by hand in command line.
Start with creating it, with the following contents:
#!/bin/bash
apt-get install ...
# do some other operations
Save it as script.sh. Now just change it's permissions, so it's executable:
$ chmod +x script.sh
Now it's ready to be invoked:
$ ./script.sh

How would you get a webpage source from Terminal? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
The community reviewed whether to reopen this question last month and left it closed:
Original close reason(s) were not resolved
Improve this question
On my website I have a text file with data on it (The site in question is hosted by GoDaddy, so I can't access the file locally). This file is updated through PHP. From the Unix/Linux/Mac bash I would like to get the contents of the text file so I can use it in scripts. Any help would be appreciated :)
curl is installed already on your Mac, so you don't need to install it. You will also find curl installed on pretty much any Linux distribution. That's probably your safest bet.
cd ~/Desktop
curl www.google.com >> google.txt
wget can be installed on your Mac easily with Homebrew. It will likely be installed already on most Linux distributions.
cd ~/Desktop
wget www.google.com
Install MacPorts and install wget:
$ sudo port install wget
And then:
$ wget http://godaddy.com/somewhere/somefile.txt
And the resulting text file will be somefile.txt (this can be changed using the -O option).

Whitespace added after path following a command with sudo [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
When I try to execute a command as super user that is followed by a path, the auto-complete (tab) will produce a whitespace after the folder:
Example, in my home folder:
"sudo cat Doc" <tab>
produces
"sudo cat Documents "
as opposed to
"sudo cat Documents/"
This is quite annoying. Any ideas what may be wrong? Did I break it or is this simply a bug?
I am running Linux Mint 13 Mate 64.
You can use bash-completion for the issue. For Debian/Ubuntu
sudo apt-get install bash-completion
This topic seems to fix it.
I am still unsure why this occurred though. I am quite certain it wasn't an issue until today.

How to run a script at the start up of Ubuntu? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I want to run some Java programs in the background when the system boots in Ubuntu. I have tried to add a script in /etc/init.d directory but failed to start a program. i.e programs are not started. What should I do for that?
First of all, the easiest way to run things at startup is to add them to the file /etc/rc.local.
Another simple way is to use #reboot in your crontab. Read the cron manpage for details.
However, if you want to do things properly, in addition to adding a script to /etc/init.d you need to tell ubuntu when the script should be run and with what parameters. This is done with the command update-rc.d which creates a symlink from some of the /etc/rc* directories to your script. So, you'd need to do something like:
update-rc.d yourscriptname start 2
However, real init scripts should be able to handle a variety of command line options and otherwise integrate to the startup process. The file /etc/init.d/README has some details and further pointers.

Resources