[Solved] How can we take copy of a file using Bash script in Ubuntu?
https://www.zyxware.com/sites/default/files/styles/user_image/public/default_images/index.png?itok=2YmREnrP
BY sarika.k
4 years ago
Bash
0 comments comment

This article will help you to declare and print a variable using programming basic, intermediate shell scripts and how to use Bash script to copy files in Ubuntu. Actually, Bash is very simple and flexible UNIX shell scripting language which need some permission while executing.

Here I'm going to share some tips of Bash Script. It does not intend to be an advanced document. To clear your doubts or share your information about Bash, you can contact us.

Using Bash script we can declare and print a variable using,

#!/bin/bash
# declare STRING variable
STRING="Hello World"
#print variable on a screen
echo $STRING

To copy files using Bash script, we can use,

#!/bin/bash
srcdir="~/Desktop/bash_script"
dstdir="~/Desktop/bash_new/"
d=$(date +%m%d%y)
srcfile="hello_world.sh"

cp $srcdir $dstdir

#for srcfile in ${srcdir}
#do
#    dstfile=$(basename $srcfile)
#    dstfile=${dstfile/\./${d}\.}
#   cp $srcfile $dstdir/$dstfile
#done

Do you need more information about Bash script or commands, checkout now.


RELATED ARTICLE

/themes/custom/zyxpro_light/images/placeholder.png
more_horiz
close

on 11th December 2008 / by webmaster
Recently we had to provide support on a Red Hat Server where there were hundreds of users and the user directories organized into hierarchies. Normally we change to a users directory using cd ~username. We had some extra time on our hands and wanted to play with the /etc/passwd file and tried to use awk to do the same thing. The following one liner will do this the hard way :-) Linux Shell Scripting Bash Leave a reply Your email address will not be published. Required fields are marked * cherry (not verified) access_time 13 Nov 2019 - 00:50 alternatively: cd `(cat /etc/passwd|grep username|cut -d ':' -f 6` ;-) Add new comment
/themes/custom/zyxpro_light/images/placeholder.png
close

on 12th December 2009 / by webmaster
Asianet Dataline is an ISP in Kerala and they use a web browser based authentication system to lo Internet Shell Scripting Bash Asianet Leave a reply Your email address will not be published. Required fields are marked * Vivek Thomas (not verified) access_time 13 Nov 2019 - 00:50 Thank you very much for this. Works great. Btw I had to add a --no-check-certificate option in the following line for it get the login URL. :) asianet_conn_url=`wget --quiet --no-check-certificate -O - www.zyxware.com|grep 'action='|sed 's/\(.*action="\)\(.*\)">/\2/g'` webmaster access_time 13 Nov 2019 - 00:50 In reply to Thank you very much for this. by Vivek Thomas (not verified) Changes duly made in git repo and credit given. Anoop JITHIN (not verified) access_time 13 Nov 2019 - 00:50 In reply to Thanks by webmaster Sir, Where is this "Favorite Scripts Folder" How Can I Copy A Script ie In Text Form To A Folde? Is Favorite Script Folder an attachment Of Internet Explorer Browser ? Please Tell Me About "START UP PROCESS" Can You Plese Explain What Should I Do Step By Step Considering Me As A Beginer. Jimmy (not verified) access_time 13 Nov 2019 - 00:50 Hi, I see the script. Can I use this script in Windows? If yes, please tell me the complete procedure to use this script in windows using the browser IE. Thanks Jimmy Anonymous (not verified) access_time 13 Nov 2019 - 00:50 Thank you very much for this. Works great. But I cant logout after use Add new comment
/themes/custom/zyxpro_light/images/placeholder.png
more_horiz
close

on 14th December 2012 / by thomas.john
The default method of changing a Drupal theme using the graphical Admin interface is familiar to most Drupal users. However a Drupal user is limited to changing only one theme at a time using this method and it is also slightly time consuming. What if you want to enable more then one theme at a time? Drupal provides a quicker way to change the theme using the bash command line. Read on to know how to enable multiple Drupal themes using the bash command line Drupal Bash Drupal Themes Drupal Theming Drush Leave a reply Your email address will not be published. Required fields are marked *
Leave a reply
Your email address will not be published. Required fields are marked *

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
The content of this field is kept private and will not be shown publicly.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.